Is there any samples on how to detect if cursor is inside the table, adding/removing rows/cols, justifying etc.
I found almost everything in RichViewActions.pas but some things are not clear and working different.
Why I can't use table.DeleteSelectedRows directly?
Why there are a lot of Access Violations (not always and try...except helps) when starting to type letters in empty cells, removing rows/cols?
How to check if current item is a table?
Also with code from rvActions my toolbar DeleteCols/Rows buttons are enabled only if whole Col/Row is selected but in rvActions have cursor inside the table is enough.
Code: Select all
rve:=TCustomRichViewEdit(RichViewEdit1.RVData.GetAbsoluteRootData.GetParentControl);
if rve.GetCurrentItemEx(TRVTableItemInfo,rve,item) then begin
table:=TRVTableItemInfo(item);
boo:=True; // We're inside the table, but it's not for 100%
if table.GetNormalizedSelectionBounds(True,a,b,c,d) then begin
if d=table.Rows.Count then bo1:=True; //TrvActionTableDeleteCols
if c=table.Rows[0].Count then bo2:=True; //TrvActionTableDeleteRows
end;
if table.CanMergeSelectedCells(True) then bo3:=True else bo4:=True;
end;