Page 1 of 1

TeeGrid cell edit and scrolling with fixed columns

Posted: Mon Feb 19, 2024 7:33 pm
by 18697358
Dear community,

I face a problem in the representation of a TeeGrid with two left-side fixed columns. If I click on a editable field (only selected) and then scroll horizontally, then the selected field is drawn over the fixed columns until it leaves the canvas.

So my questions are:
a) How can I keep the row selected but with unselected cell?
b) How can I unedit a cell programmatically?

Any suggestions are highly appreciated.
Thank you very much!

Re: TeeGrid cell edit and scrolling with fixed columns

Posted: Mon Feb 26, 2024 9:25 am
by Marc
Hello,

Re. (a)

I'm not sure that you can select a row without a cell being implicitly selected. TeeGrid starts with the zero,zero location cell selected. If you were to add this code for example, it indicates the row selected:

Code: Select all

uses Tee.Grid.Selection
procedure TFormLocked.TeeGrid1Select(Sender: TObject);
var mySelected : TGridSelection;
begin
  mySelected := TVCLTeeGrid(Sender).Selected;
  showmessage(IntToStr(mySelected.Row));
end;
You could define the mySelected variable with a wider scope or as a variable to take your required selection and use it to set a selected cell/row;

eg.

Code: Select all

procedure TFormLocked.Button1Click(Sender: TObject);
begin
  TVCLTeeGrid(Sender).Selected := mySelected;
end;
For more specific information on setting a selected col/row see the Cell Editors example:
https://github.com/Steema/TeeGrid-VCL-F ... %20Editors

Re. b) How can I unedit a cell programmatically?
I think I don't understand the objective. If it's to undo a change then you'll need to code that yourself, taking a backup of content before an edit to later roll-back to if required. Please clarify if I've misunderstood,

Regards,
Marc Meumann