How can you tell if a table in a table has the focus?
How can you tell if a table in a table has the focus?
How can you tell if a table in a table has the focus?[/b]
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
If rve.TopLevelEditor=rve, the caret is not in table cell.
If rve.TopLevelEditor=rve.InplaceEditor, the caret is inside cell of table that inserted in rve.
Otherwise, the caret is inside a cell of table in table, or table in table in table, and so on.
You can find the level of nesting:
The text and the code above assumes that you are interested in a table having a cell containing the caret. However, GetItemEx method (used in RichViewActions and Editor1 demo to get the table to operate) may return a table having the caret to the right or to the left. For example, if the table A contains the table B, and the caret is to the right of the table B, GetItemEx returns table B, not table A, despite the fact that the caret is in the cell of table A. If you are in this kind of focus, you can compare the editor returned by GetItemEx (the editor containing the table) with rve, rve.InplaceEditor, and so on.
If rve.TopLevelEditor=rve.InplaceEditor, the caret is inside cell of table that inserted in rve.
Otherwise, the caret is inside a cell of table in table, or table in table in table, and so on.
You can find the level of nesting:
Code: Select all
function GetNestingLevel(rve: TCustomRichViewEdit): Integer;
begin
Result := 0;
while rve.InplaceEditor<>nil do begin
inc(Result);
rve := TCustomRichViewEdit(rve.InplaceEditor);
end;
end;