WaitForKeys Method Example

The example waits for the user to press the "a" character or for nine seconds to elapse.

Sub Main()

 Dim Sys As Object, Sess As Object, MyScreen As Object

 

 Set Sys = CreateObject("EXTRA.System")

' Assumes an open session

 Set Sess = Sys.ActiveSession

 Set MyScreen = Sess.Screen

 

 ' Method 1: As set in TimeoutValue property,
 ' WaitForKeys will wait for nine seconds until
 ' the "a" key is pressed

 Sys.TimeoutValue = 9000

 Wait4Keys$ = MyScreen.WaitForKeys("a")

 MsgBox "WaitForKeys returned " + Wait4Keys$ + "."

 

 ' Method 2: As set in the Timeout parameter,
 ' WaitForKeys will wait for nine seconds until
 ' the "a" key is pressed

 Wait4Keys$ = MyScreen.WaitForKeys(9000, "a")

 MsgBox "WaitForKeys returned " + Wait4Keys$ + "."

End Sub