Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmScreen Object / NewScreenReady Event
Example
NewScreenReady Event
Occurs as soon as the screen has been quiet for the time duration specified by the ScreenSettleTime property.
Syntax
private Sub IbmScreen_NewScreenReady ( 
   ByVal sender As Object _
) 

Parameters

sender
Sender of event.
Example

This example opens the Macros dialog box when a specific screen is identified.

To run this example, copy this code to ThisIbmScreen code window.

This sample displays a button on the ribbon that runs a macro on a specific screen. The button is not displayed on other screens.
Private Sub IbmScreen_NewScreenReady(ByVal sender As Variant)
   
  Dim ScreenID1 As String
  Dim Rtn As ReturnCode
  
  'Get the string at this screen position that uniquely identifies the screen
  'For this example, the text at row 1 and column 7 is 'ATM5'
  ScreenID1 = ThisIbmScreen.GetText(1, 7, 4)
  
 
  'If the screen ID is 'ATM5', open the Macros dialog box
  If ScreenID1 = "ATM5" Then
 
    ThisIbmTerminal.Macro.ShowMacroDialog
    
  End If
 
End Sub
This example loads a message in the Scratch Pad when a specific screen is ready. To run this example, copy this code to the ThisIbmScreen code window and save a scratchpad file as ScratchPadMessage.rtf in your Documents\Micro Focus\Reflection\ folder.
Private Sub IbmScreen_NewScreenReady(ByVal sender As Variant)
    
    Dim ScreenID1 As String
    Dim Rtn As ReturnCode
    Dim path As String
    
    'Get the string at this screen position that uniquely identifies the screen to display the message on.
    'For this example, the text at row 1 and column 38 is 'Entry Panel'
    ScreenID = ThisIbmScreen.GetText(1, 38, 11)
       
    'If this screen is the screen we want, load the file and show the Scratch Pad.
    If ScreenID = "ENTRY PANEL" Then
        
        path = Environ("USERPROFILE") & "\Documents\Micro Focus\Reflection\ScratchPadMessage.rtf"
        
        ThisIbmTerminal.Productivity.ScratchPadLoad (path)
        
        ThisIbmTerminal.Productivity.ScratchPadPanelVisible = True
 
    End If
    
End Sub
Private Sub IbmScreen_NewScreenReady(ByVal sender As Variant)
   Dim ui As UiMode
   Dim control As UiControl
   Dim screenID As String
  
   'Get the UiMode object that contains the controls for this view.
   Set ui = ThisView.UiMode
  
   'Get the control. The control ID is displayed in the Identifier field on the UI Designer.
   Set control = ui.GetControlById("button2")
  
   'Get the text to identify the screen
   screenID = Trim(ThisIbmScreen.GetText(1, 25, 13))
 
  
   Debug.Print screenID
   'When the appropriate screen is ready, make the control visible
   If screenID = "INTERNATIONAL" Then
      control.Visible = True
   Else
      control.Visible = False
   End If
End Sub
Requirements
See Also