Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmScreen Object / WaitForKeyboardEnabled Method
Specifies how long to wait for the keyboard to become enabled (in seconds).
Specifies how long the keyboard must remain enabled (in seconds).
Example
WaitForKeyboardEnabled Method
Wait for the keyboard to be enabled (unlocked and ready for additional input).
Syntax
expression.WaitForKeyboardEnabled( _
   ByVal timeout As Integer, _
   ByVal duration As Integer _
) As ReturnCode
where expression is a variable that represents a IbmScreen Object

Parameters

timeout
Specifies how long to wait for the keyboard to become enabled (in seconds).
duration
Specifies how long the keyboard must remain enabled (in seconds).

Return Value

One of the following ReturnCode enum values.

Member Description
Cancelled Cancelled.
Error Error.
PermissionRequired Permission is required.
Success Success.
Timeout Timeout condition.
Truncated The text is truncated.

Remarks
If you know the initial position of the cursor or a text string on the screen you are navigating to, consider using the WaitForCursor, waitForText1, or WaitForText2 methods. These methods are more efficient than using the set time to wait for the host to respond.
Example

This sample uses the WaitForKeyboardEnabled and SendContolKey methods to navigate to the "Edit - Entry Panel" screen on the IBM3270 demo and writes some text on the last screen.

To run this sample, create a 3270 session and set the Host name / IP address to demo:ibm3270.sim. Then paste this code into a VBA module and run the macro from the login screen.

Sub NavigateWithKeyboardEnabledMethod()
    'Declare application, terminal, and view object variables:
    Dim terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal
    Dim screen As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmScreen
    
    Set terminal = ThisIbmTerminal
  
    'Get a handle to the Screen object and navigate to the screen we
    'want to enter the data on
    Set screen = terminal.screen
  
    'Navigate to the screen
    rcode = screen.SendControlKey(ControlKeyCode_Transmit)
    
    rcode = screen.WaitForKeyboardEnabled(3, 2)
    rcode = screen.SendKeys("ISPF")
    rcode = screen.SendControlKey(ControlKeyCode_Transmit)
  
    rcode = screen.WaitForKeyboardEnabled(3, 2)
    rcode = screen.SendKeys("2")
    rcode = screen.SendControlKey(ControlKeyCode_Transmit)
  
    rcode = screen.WaitForKeyboardEnabled(3, 2)
   
   
    'Put some text into a field on the last screen
    rcode = screen.PutText2("Finished", 5, 18)
    
    End Sub
See Also