WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-18-2008, 09:57 PM
yyang yyang is offline
Member
 
Join Date: Aug 2008
Posts: 3
Question Question about input from virtual keyboard.

Hi, I run into a problem and need your help.
I created a 3D virtual keyboard that allow users to click on the virtual keys to input information. When user hits the virual "Enter" key, the entered string will be saved in a variable. My applicaiton uses HMD, it's not convenient for user to use the physical keyboard.

My problem is, when I use this virtual keyboard in my system, how can I make my program wait (halt) until the virtual "return" key is pressed (just like the viz.input())? I tried to use event, viztask and signal system to do the synchronization, but somehow can't make it work.
Please give me some help.

Thanks,
Reply With Quote
  #2  
Old 12-22-2008, 10:01 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,455
Can you post some code to show how you set up the virtual keyboard?
Reply With Quote
  #3  
Old 12-22-2008, 10:04 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,455
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.
Reply With Quote
  #4  
Old 12-22-2008, 04:43 PM
yyang yyang is offline
Member
 
Join Date: Aug 2008
Posts: 3
Quote:
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.

# I WANT MY PROGRAM TO WAIT HERE UNTIL THE VR KEYBOARD
# 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
  #5  
Old 12-23-2008, 12:25 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,455
Try using viztask to keep track of the flow of your program. You can yield until a signal is sent when your enter node3D is clicked on.

Code:
import viztask

s = viztask.Signal()

def MyTask():

	yield s.wait()
	#save your data
	
	
viztask.schedule( MyTask() )

vizact.onpick(enter_node, s.send)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Gps input for viewpoint location? realvision Vizard 3 03-19-2008 12:37 PM
General question and question regarding arrays dan12345 Vizard 1 01-15-2008 10:15 AM
Human FOV and VIrtual FOV giancamati Vizard 0 12-14-2006 03:33 AM
Timer vs. Keyboard input Wenamun Vizard 1 01-23-2006 09:04 PM
problem with input boxes shai Vizard 6 08-15-2005 10:51 AM


All times are GMT -7. The time now is 07:15 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC