Description
Test the cursor position against a table. See also InTabulation Method.
Syntax
dim bValue as Boolean = object.TestTabulation (nWhat, bStart) |
object
Required. Object name, returned by Text.GetCursor(...).
nWhat
specifies what to test:
tpTable or 0 = whole table,
tpRow or 1 = tabulation row,
tpCell or 2 = tabulation cell
bStart
If bStart is true the function returns true if the cursor position is at the start of the element specified by nWhat. If bStart is false the function returns true if the cursor position is at the end of the element specified by nWhat.
Example
Displays the description of the position of the I-beam in a table. Have in mind that one position can be described with more than one statement, e.g. if you put the I-beam in an empty table cell, the returned result will be:
In a table
At row end
At cell beginning
At cell end
ShowTableDesc (Text.GetCursor(modeSame,cposCursor,False),"At cursor")
'Extra Subs
Sub ShowTableDesc(objCur,strCaption)
Dim str
If Not objCur.InTabulation Then
str = "Not in a table"
Else
str = "In a table"
If objCur.TestTabulation(tpTable,True) Then
str = str & vbCrLf & "At table beginning"
End If
If objCur.TestTabulation(tpTable,False) Then
str = str & vbCrLf & "At table end"
End If
If objCur.TestTabulation(tpRow,True) Then
str = str & vbCrLf & "At row beginning"
End If
If objCur.TestTabulation(tpRow,False) Then
str = str & vbCrLf & "At row end"
End If
If objCur.TestTabulation(tpCell,True) Then
str = str & vbCrLf & "At cell beginning"
End If
If objCur.TestTabulation(tpCell,False) Then
str = str & vbCrLf & "At cell end"
End If
End If
MsgBox (str,vbOkOnly,strCaption)
End Sub
For the meaning of the standard constants see Constants related to Cursor and TxtPosDesc object.