table a in table b
how to select the text item using code. such as
Code: Select all
SRichViewEdit1.ActiveEditor.TopLevelEditor.SetSelectionBounds
Code: Select all
SRichViewEdit1.ActiveEditor.TopLevelEditor.SetSelectionBounds
Code: Select all
SRichViewEdit1.ActiveEditor.TopLevelEditor.SetSelectionBounds
Code: Select all
TRVTableCellData(tobj.Items[ListBox1.ItemIndex]).SetCursor(crDefault) ;
TRVTableCellData(table.Cells[0,0]).SetSelectionBounds(
0,0,0,Length(TRVTableCellData(table.Cells[0,0])).GetItemTextW(0))+1);
Code: Select all
SRichViewEdit1.ScrollToItem(table.Cells[0,0]),i);
Code: Select all
var RVData: TCustomRVFormatteData;
table.EditCell(0, 0);
RVData := TCustomRVFormatteData(table.Cells[0,0]).GetRVData;
RVData.SetSelectionBounds(0, RVData.GetOffsBeforeItem(0), 0, RVData.GetOffsAfterItem(0));
Thank you, this was very helpful. Although I had to use TCustomRVFormattedData.Sergey Tkachenko wrote:The correct code:
Code: Select all
var RVData: TCustomRVFormatteData; table.EditCell(0, 0); RVData := TCustomRVFormatteData(table.Cells[0,0]).GetRVData; RVData.SetSelectionBounds(0, RVData.GetOffsBeforeItem(0), 0, RVData.GetOffsAfterItem(0));
Yes, that seems obvious. But as I mentioned above, that doesn't work. Consider the scenario:Sergey Tkachenko wrote:While you select in a cell yourself, you can set some flag in your application.
In OnCellEditing, you can check this flag and do not mark this record as modified if it is set.
The documentation states that OnChange and OnChanging are members of TCustomRichViewEdit. While that is true, they are protected members and are not accessible via TCustomRichViewEdit.JonRobertson wrote:While writing this, I just found InplaceEditor. Perhaps in OnCellEdit I can set InplaceEditor.OnChange to another event that would tell me if the user actually changed the cell. I'll give that a shot.
That doesn't work, as OnCellEditing is called before InplaceEditor is created. Again, that makes sense, as I could set AllowEdit to False in OnCellEditing.JonRobertson wrote:While writing this, I just found InplaceEditor. Perhaps in OnCellEdit I can set InplaceEditor.OnChange to another event that would tell me if the user actually changed the cell. I'll give that a shot.
I found a solution that works well. In TRichViewEdit.OnChange, if InplaceEditor is assigned, then I use GetCellPosition to determine which cell the user is changing.JonRobertson wrote:But I'm out of ideas at this point. Looking forward to any suggestions you may have.
That was it.Sergey Tkachenko wrote:There is another possibility: when all table cells are selected, the table looks like if it is selected completely. In this case, GetSelectionBounds returns the position either before or after the table, and IsCellSelected must return True for all cells.