Marking the whole table row and the whole table column of a focused table cell
Posted: Thu Dec 19, 2019 12:17 pm
Hello,
my code for marking the whole table row and the whole table column of a focused table cell works as long as I put the code into a panel (.sbTabZeilefaerbenClick (Sender: TObject)).
But if I set it in .memoRVDblClick (Sender: TCustomRichView; ClickedWord: TRVUnicodeString; Style: Integer) I get an 'Abstract Error'.
What can I do - when I click on a cell - the whole table row and the whole table column of the focused cell are highlighted in yellow?
Jürgen
(D7 and TRichViewEdit 17.6)
// Code is OK (I must first focus the cell, then click below panel-button):
procedure TForm1.sbTabZeilefaerbenClick (Sender: TObject);
var i, j, h color: integer;
cs, rs, itemNo, Data: integer; // Color the entire font background
begin // This procedure is wg. an abstract error if the content is captured elsewhere
// Does table have the cursor?
if (not memo.CanChange) or (not memo.GetCurrentItemEx (TRVTableItemInfo, rve,
TCustomRVItemInfo (rveTable))) then begin
ShowMessage ('This option is intended to provide better orientation in a table,' + # 10 +
'by using the focused line u. Column turns yellow (discolored). '+ # 10);
exit;
end;
try
ItemNo: = rveTable.GetMyItemNo;
memo.BeginUndoGroup (rvutModifyItem);
memo.SetUndoGroupMode (True);
memo.BeginItemModify (ItemNo, Data);
// Determine the focused line here
cs: = - 1; rs: = - 1;
rveTable.GetNormalizedSelectionBounds (true, rveTzeile1, rveTspalte1, CS, RS);
if (cs = -1) and (rs = -1) then exit;
// Determine the focused cell color
hColor: = rveTable.cells [rveTzeile1, rveTspalte1] .color;
if hFarbe = clWhite then hFarbe: = 11993087 else hFarbe: = clWhite;
// Color all cells in the table white
For j: = 0 to rveTable.Rows.Count-1 do
for i: = 0 to rveTable.Rows [rveTzeile1] .Count-1 do
rveTable.SetCellColor (clWhite, j, i);
// Color focused cells in a row
for j: = 0 to rveTable.Rows [rveTzeile1] .Count-1 do
rveTable.SetCellColor (hFarbe, rveTzeile1, j);
// Color focused cells in a column
for j: = 0 to rveTable.Rows.Count-1 do
rveTable.SetCellColor (hFarbe, j, rveTspalte1);
finally
memo.EndItemModify (ItemNo, Data);
memo.SetUndoGroupMode (False);
memo.Change;
if memo.GetCurrentItemEx (TRVTableItemInfo, rve, TCustomRVItemInfo (rveTable)) then rveTable.EditCell (rveTzeile1, rveTspalte1);
end;
end; // of .sbTabZeilefaerbenClick
procedure TForm1.memoRVDblClick(Sender: TCustomRichView; ClickedWord: TRVUnicodeString; Style: Integer);
begin //Wenn memo.onDblClick vorliegt, wird dies Procedure nicht mehr durchlaufen
if Screen.Cursor=crHandPoint then begin
HyperlinkInfo;
HyperlinkAusfuehren;
end;
//sbTabZeilefaerbenClick (Self); //abstract error - Delphi ist frozen
end;
my code for marking the whole table row and the whole table column of a focused table cell works as long as I put the code into a panel (.sbTabZeilefaerbenClick (Sender: TObject)).
But if I set it in .memoRVDblClick (Sender: TCustomRichView; ClickedWord: TRVUnicodeString; Style: Integer) I get an 'Abstract Error'.
What can I do - when I click on a cell - the whole table row and the whole table column of the focused cell are highlighted in yellow?
Jürgen
(D7 and TRichViewEdit 17.6)
// Code is OK (I must first focus the cell, then click below panel-button):
procedure TForm1.sbTabZeilefaerbenClick (Sender: TObject);
var i, j, h color: integer;
cs, rs, itemNo, Data: integer; // Color the entire font background
begin // This procedure is wg. an abstract error if the content is captured elsewhere
// Does table have the cursor?
if (not memo.CanChange) or (not memo.GetCurrentItemEx (TRVTableItemInfo, rve,
TCustomRVItemInfo (rveTable))) then begin
ShowMessage ('This option is intended to provide better orientation in a table,' + # 10 +
'by using the focused line u. Column turns yellow (discolored). '+ # 10);
exit;
end;
try
ItemNo: = rveTable.GetMyItemNo;
memo.BeginUndoGroup (rvutModifyItem);
memo.SetUndoGroupMode (True);
memo.BeginItemModify (ItemNo, Data);
// Determine the focused line here
cs: = - 1; rs: = - 1;
rveTable.GetNormalizedSelectionBounds (true, rveTzeile1, rveTspalte1, CS, RS);
if (cs = -1) and (rs = -1) then exit;
// Determine the focused cell color
hColor: = rveTable.cells [rveTzeile1, rveTspalte1] .color;
if hFarbe = clWhite then hFarbe: = 11993087 else hFarbe: = clWhite;
// Color all cells in the table white
For j: = 0 to rveTable.Rows.Count-1 do
for i: = 0 to rveTable.Rows [rveTzeile1] .Count-1 do
rveTable.SetCellColor (clWhite, j, i);
// Color focused cells in a row
for j: = 0 to rveTable.Rows [rveTzeile1] .Count-1 do
rveTable.SetCellColor (hFarbe, rveTzeile1, j);
// Color focused cells in a column
for j: = 0 to rveTable.Rows.Count-1 do
rveTable.SetCellColor (hFarbe, j, rveTspalte1);
finally
memo.EndItemModify (ItemNo, Data);
memo.SetUndoGroupMode (False);
memo.Change;
if memo.GetCurrentItemEx (TRVTableItemInfo, rve, TCustomRVItemInfo (rveTable)) then rveTable.EditCell (rveTzeile1, rveTspalte1);
end;
end; // of .sbTabZeilefaerbenClick
procedure TForm1.memoRVDblClick(Sender: TCustomRichView; ClickedWord: TRVUnicodeString; Style: Integer);
begin //Wenn memo.onDblClick vorliegt, wird dies Procedure nicht mehr durchlaufen
if Screen.Cursor=crHandPoint then begin
HyperlinkInfo;
HyperlinkAusfuehren;
end;
//sbTabZeilefaerbenClick (Self); //abstract error - Delphi ist frozen
end;