Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Waitforkeys method

Status
Not open for further replies.

manuelogando

IS-IT--Management
Apr 5, 2002
3
0
0
ES
Does anybody knows how does the Waitforkeys method works?
I'm developing an application in VB that interacts with an Extra 3270 emulation.
I needed to wait any key in the Extra 3270 emulation to be pressed. But when the key is pressed I need to know which was the key that the user pressed.

If think the right way to do it is writting the sentence:

keypressed=Screen.WaitForKeys(-1,"")

When I execute this sentence the result is that it detects when any key is pressed but the variable "keypressed" is empty.

Does anybody know if there's any way to make what I need?
Thanks.
 
I have used the hllapi Function 50: Start Keystroke Intercept to complete this task. Basically this function will intercept any keystroke the user presses. The only draw back is that you must handle each of the keys you are looking for. Hope that helps.
 
Here is what is included in the 6.7 version 'Help' manual.

Applies To Objects

Screen

Description

Waits until the user presses a key or for the specified time to elapse before the program will continue processing.

Syntax

rc = object.WaitForKeys ([Timeout [,UserKeys]])
-or-
object.WaitForKeys [Timeout [,UserKeys]]

Element Description
rc The return value.
object The Screen object.
Timeout The time for the Screen object to wait, in milliseconds. If no timeout value is specified, the Screen object waits until a key is pressed.
UserKeys One or more keys that the user must press for the program to continue processing. If no string is specified, any keystroke will continue program processing.
Return Value Description
UserKeys The UserKeys keys that the user pressed.
empty string Indicates that no key was pressed within the specified time or that the key that the user pressed was not one of the UserKeys you supplied in the WaitForKeys method syntax.

Copyright 1996 - 2000, Attachmate Corporation. All rights reserved.

* Here is an example from the 'Help' manual.

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

Copyright 1996 - 2000, Attachmate Corporation. All rights reserved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top