InfoConnect VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Screen Object / DisplayText2 Method
The string to display.
A DisplayTextOption value
Example
In This Topic
    DisplayText2 Method
    In This Topic
    Displays a string in the terminal window as though it had been received from the host.
    Syntax
    expression.DisplayText2( _
       ByVal text As String, _
       ByVal option As DisplayTextOption _
    ) As ReturnCode
    where expression is a variable that represents a Screen Object

    Parameters

    text
    The string to display.
    option
    A DisplayTextOption value

    Return Value

    One of the following ReturnCode enumeration values.

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

    Remarks
    You can add color to your displayed text by using the OpenVMS Visual Attribute escape sequences. To do this, modify the "Text Color Mapping"
    section in your Theme to set the colors you want to use. For example, you could set the "Blink Bold" attribute to be white text on a green background,
    by selecting White as the Foreground color, and Green as the Background color. Then any text displayed with the Blink and Bold attributes is displayed in these colors.
    Example
    These examples show how to display a string in the terminal window with the escape sequence interpreted using the hexadecimal character conversions.
    'This example displays the fraction symbol ¼ (using the decimal code x0BC) followed by a carriage return (using the \r special character).
    Sub DisplayText2Example()
        Dim rcode As ReturnCode
     
        rcode = ThisScreen.DisplayText2("\x0BC\r", DisplayTextOption_HexData)
     
    End Sub
     
     
    'This example gets a row of text from the screen and displays it with Bold and Blink attributes
    'You can run this example by creating a VT session with the Host name/IP address set to 'demo:unix', logging in with any credentials and entering demodata to navigate to the
    'XYZ Company Sales graph. Then run this code in a code module.
    Sub DisplayText2Example2()
     
        Dim sequence, text As String
        Dim point As ScreenPoint
        Dim row, column, length As Integer
     
        'Get the location of the text that starts with XYZ
        Set point = ThisScreen.SearchText("XYZ", 1, 1, FindOptions_Forward)
     
        'Set the starting row, the starting column, and the number of characters remaining on the line (length)
        row = point.row
        column = point.column
        length = ThisScreen.DisplayColumns - column
     
        'Get the text from the screen location to the end of the row
        text = ThisScreen.GetText(row, column, length)
     
        'Create the escape sequence, using the OpenVMS visual attributes escape sequences
        'This statement moves the cursor to the starting row and column, Then it sets the Bold and Blink attributes ( \x01B[1;5m ), displays the text, and resets the attributes ( \x01B[0m ).
        '(\x01B is the Esc character in Hex)
        sequence = "\x01B[" & row & ";" & column & "H" & "\x01B[1;5m" & text & "\x01B[0m"
     
        'Display the text using the escape sequence interpreted using the hexadecimal character conversions
        ThisScreen.DisplayText2 sequence, DisplayTextOption_HexData
     
    End Sub
    See Also