Reflection Desktop VBA Guide
Attachmate.Reflection.Objects Library / Attachmate.Reflection.Objects.UserInterface Library / View Object / Focus Method
Example
In This Topic
Focus Method
In This Topic
Sets the input focus to the view.
Syntax
expression.Focus() 
where expression is a variable that represents a View Object
Example
This example changes the focus to another session in the workspace.
Sub ChangeFocus()
 
    Dim positionInString As Variant
    Dim viewTitle As String
  
    'Reflection objects required to open a new session
    Dim views() As Attachmate_Reflection_Objects.View
    Dim View As Variant
 
    'Get the text to copy from the current session
    projectName = ThisIbmScreen.GetText(1, 39, 5)
        
    'Get all the view objects in the frame and print the title of each view
    views = ThisFrame.GetViewsByName("")
    
    For Each View In views
        
        'Get the view title
        viewTitle = View.titleText
        
        'If the view title contains session2, change the focus to that session
        positionInString = InStr(viewTitle, "session2")
        
        If positionInString > 0 Then
 
            View.Focus
            
        End If
                        
    Next
 
End Sub
See Also