Cell Property  
 

Returns information about the specified character cell in the display.

Syntax

object.Cell( X, Y )

Remarks

The Cell property returns information about the specified character cell in the display at the specified X and Y cursor position.

The value returned by the Cell property is a 32-bit integer value, where the low order word specifies the ANSI character stored at that position and the high order word specifies the display attributes for that cell.

The character cell attributes may be one or more of the following values:

Value Constant Description
0 nvtAttributeNormal Normal, default attributes.
1 nvtAttributeReverse Foreground and background cell colors are reversed.
2 nvtAttributeBold The character is displayed using a higher intensity color.
4 nvtAttributeDim The character is displayed using a lower intensity color.
16 nvtAttributeUnderline The character is displayed with an underline.
32 nvtAttributeHidden The character is stored in display memory, but not shown.
64 nvtAttributeProtect The character is protected and cannot be cleared.

One or more attributes may be combined using a bitwise Or operator. Certain attributes, such as nvtAttributeBold and nvtAttributeDim are mutually exclusive.

Data Type

Integer (Int32)

Example

To access the high and low words of the value returned by the Cell property in Visual Basic 6, it's useful to implement two helper functions:

Public Function LoWord(DWord As Long) As Integer
    If DWord And &H8000& Then
        LoWord = DWord Or &HFFFF0000
    Else
        LoWord = DWord And &HFFFF&
    End If
End Function

Public Function HiWord(DWord As Long) As Integer
    HiWord = (DWord And &HFFFF0000) \ &H10000
End Function

You can then use those functions to get the character and attributes for the cell:

Dim nCell As Long
Dim nChar As Integer
Dim nAttribute As Integer

nCell = Terminal1.Cell(xPos, yPos)
nChar = LoWord(nCell)
nAttribute = HiWord(nCell)

See Also

Attributes Property