Example

This example demonstrates how to test the character attributes of each character in the current screen display. For this example, each character is tested for a particular attribute. If that attribute is found, the coordinates are displayed and we exit from the procedure. A bit-wise comparison is used to test the returned attribute.

Sub DetermineCharacterAttributes ()

Dim row, minRow, maxRow as Integer

Dim column, minColumn, maxColumn as Integer

Dim thisAttribute as Integer

 

With Session

 minRow = .ScreenTopRow

 maxRow = .DisplayRows -1

 

 minColumn = 0

 maxColumn = .DisplayColumns - 1

 

 'For all rows and all columns on screen

 For row = minRow to maxRow   

  For column = minColumn to maxColumn  

  

   'Check the current character

   thisAttribute = .CharacterAttributes(row, column) 

   

    'Check to see if this is the last character on the line.

    If (thisAttribute = rcNoCharacter) Then  

   Exit For

  End If

  

  'Do whatever you want with the attribute.

  'For this example, use a bitwise comparison to test for blinking

  'text. The bitwise test means that the returned attribute will pass if it

  'just blinking, and also if it combines blinking with some other attribute.

  'If blinking text is found, display the coordinates and

  'exit from the procedure.

  If (thisAttribute And rcBlinkAttribute) > 0 Then

   MsgBox "Blinking text begins at row "& row & ", column " & column

   Exit Sub

  End If

  

  Next column

 Next Row

 

End With

End Sub