View Single Post
Old 12-22-2008, 04:43 PM
yyang yyang is offline
Join Date: Aug 2008
Posts: 3
Originally Posted by Jeff View Post
If each key is its own node3D object you could use vizact.onpick to call a function that saves your data when the enter object is clicked on.
Thanks for your reply. I developed a VRKeyboard class that allows users to use mouse to click on the keys (each one is a 3D object). The values of the keys clicked will be saved to a string variable. When the "Enter" key is pressed, the keyboard will disappear. I use this class as following:

myKeyboard = VRKeyboard() #declare an instance of the class
myKeyboard.Show() #make the 3D keyboard appear on the screen

#The VR keyboard always faces the viewpoint. User now can use mouse
# to click on the keys just like he types on the real keyboard. All the
# key values will be saved in a variable: self.inputString
# When the "Enter" key is pressed, the vr keyboard is hidden.

# INPUT FINISHES. That means I want my program to sit here until
# the user presses the "Enter" on the virtual keyboard.
(I tried to put the VRKeyboard operation in the viz.director(), then use a while statement here to wait for the keyboard input ends. But the while statement freezes the system, including the keyboard input. ).

Do we have any way to make the program stops here while still allow user to click the virtual keys, and after "Enter" is clicked, keep on executing the following sentences?

#Now I can use the myKeyboard.inputString value to do what I want in the
# following sentences.
print myKeyboard.inputString #display the user's input from the VR keyboard.
Reply With Quote