Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmScreen Object / PutText2 Method
The text to place on the screen.
The row of the screen location to put the text in.
The column of the screen location to put the text in.
Example
In This Topic
    PutText2 Method
    In This Topic

    Puts text at a specified screen location. PutText2 has two modes: Mask and LinearStream. These modes are set with the PutTextMaskProtectedField Property.

    In Mask mode (the default), text that coincides with protected fields is skipped and is not placed on the screen.

    In LinearStream mode, protected fields are ignored and the text is placed sequentially in unprotected fields until all of the text is placed on the screen.

    Syntax
    expression.PutText2( _
       ByVal text As String, _
       ByVal row As Integer, _
       ByVal column As Integer _
    ) As ReturnCode
    where expression is a variable that represents a IbmScreen Object

    Parameters

    text
    The text to place on the screen.
    row
    The row of the screen location to put the text in.
    column
    The column of the screen location to put the text in.
    Exceptions
    ExceptionDescription
    This exception is thrown if the row or column parameters are outside the range of valid values: (1 to Rows) or (1 to Columns).
    Remarks

    By default, the PutText methods (PutText1 and PutText2) are set to use Mask mode. You can use the PutTextMaskProtectedField Property to change to LinearStream mode.

    The following examples show the differences between using the Mask and LinearStream modes on the following screen.

    ----------------------------------------------------------------------------------------------

    ADDR1 : - ___________________ - CITY: - _________ - ST: - __ - ZIP: - _________

    ADDR2 : - 705 5th Ave S -------- CITY: Seattle ---- ST: - WA-ZIP: - 33764-9740

    PHONE1: - 555-555-5555 - PHONE2: __________ being cu

    PWD1=>: ----------------------- PWD2=>: ---------- _____________ d sent in full

    ----------------------------------------------------------------------------

    Using PutText2 in Mask mode

    This example shows how text is put on the screen when the PutTextMaskProtectedField Property is set to mask mode.

    Sub PutTextUsingMaskMode

    Dim str As String

    str = "This is a test to see if any memo text is being cut off unexpectedly and sent in full"

    ThisIbmScreen.PutTextMaskProtectedField = PutTextModeOption_Mask

    ThisIbmScreen.PutText2 str, 5, 10

    End Sub

    The protected fields are masked. The parts of the text string that coincide with the protected fields are skipped and are not placed on the screen.

    ----------------------------------------------------------------------------------------------

    ADDR1 : - This is a test to se - CITY: - y memo tex - ST: - be - ZIP: - t off inex

    ADDR2 : - 705 5th Ave S --------- CITY: Seattle ---- ST: - WA-ZIP: - 33764-9740

    PHONE1: - 555-555-5555 - PHONE2: -being cut off

    PWD1=>: ----------------------- PWD2=>: ---------d sent in full

    --------------------------------------------------------------------------

    Using PutText2 in LinearStream mode

    This example shows how text is put on the screen when the PutTextMaskProtectedField Property is set for linear stream mode.

    Sub PutTextUsingLinearStreamMode

    Dim str As String

    str = "This is a test to see if any memo text is being cut off unexpectedly and sent in full"

    ThisIbmScreen.PutTextMaskProtectedField = PutTextModeOption_LinearStream

    ThisIbmScreen.PutText2 str, 5, 10

    End Sub

    The protected fields are ignored and the text is pasted into the next unprotected field or hidden field (In this example, the "unexpectedly an" part of the string is put into hidden fields PWD1 and PWD2). All of the text is placed on the screen.

    ----------------------------------------------------------------------------------------------

    ADDR1 : - This is a test to se CITY: - e if any m - ST: - em - ZIP: - o text is

    ADDR2 : -705 5th Ave S --------- CITY: Seattle e--- ST: - WA-ZIP: - 33764-9740

    PHONE1: - 555-555-5555 PHONE2: - being cut off

    PWD1=>: ----------------------- PWD2=>: --------- d sent in full

    ---------------------------------------------------------------------------

    For more about using the PutText2 method, see:

    Navigating Through Open Systems Sessions

    Get Screen Data With an Excel Macro

    Enter Data from an Excel Spreadsheet

    Get Data From a Spreadsheet

    Example

    This example enters a user name and prompts for a password after the session connects.

    To run this sample, copy the code to the ThisIbmTerminal code window.

    Private Sub IbmTerminal_AfterConnect(ByVal sender As Variant)
     
        Dim rcode As ReturnCode
        Dim pw As String
        
        'Prompt for a password
        pw = ThisIbmTerminal.Macro.PasswordBox("enter your password", "password")
        
        'Move the cursor to the user name field and put the user id in that field
        rcode = ThisIbmScreen.MoveCursorTo1(20, 16)
        rcode = ThisIbmScreen.PutText2("userid", 20, 16)
               
        'Put the password in the password field
        rcode = ThisIbmScreen.PutText2(pw, 21, 16)
        
        'Enter the user ID and password
        ThisIbmScreen.SendControlKey ControlKeyCode_Transmit
     
    End Sub
    See Also