SetCaret to end of Cell contents in a Table

General TRichView support forum. Please post your questions here
Post Reply
JavaKinetic
Posts: 3
Joined: Tue Mar 07, 2006 8:05 pm

SetCaret to end of Cell contents in a Table

Post by JavaKinetic »

Quick question: When I am tabbing through cells in a table, I would like the cursor to set at the end of the contents of the cell.

SelectCurrentWord and GetSelText appear to be the methods to use, but is there an ideal way to do this?

I think TRichView is absolutely amazing... but... there is soooo much to read... wonder if I have missed something.

Thanks for the great product!
JavaKinetic
Posts: 3
Joined: Tue Mar 07, 2006 8:05 pm

Post by JavaKinetic »

// This will send the caret to the end of the text in a cell.
// -- Might be a behaviour one day ;-)
// -- Editing of Cells in table
procedure TMainForm.OnCellEditing(Sender: TRVTableItemInfo; Row, Col: Integer;
Automatic: Boolean; var AllowEdit: Boolean);
var
mCell : String;
begin

// Go to end of cell if data already in it
mCell := table.Cells[ Row, Col ].GetRVData.GetItemText(0);
if mCell <> '' then
begin
// Force a keystroek
keybd_event( VK_END, MapVirtualkey( VK_END, 0 ), 0, 0);
end;
end;
Post Reply