TeeGrid cell edit and scrolling with fixed columns

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
MTG
Newbie
Newbie
Posts: 3
Joined: Wed Dec 27, 2023 12:00 am

TeeGrid cell edit and scrolling with fixed columns

Post by MTG » Mon Feb 19, 2024 7:33 pm

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!

Marc
Site Admin
Site Admin
Posts: 1213
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TeeGrid cell edit and scrolling with fixed columns

Post by Marc » Mon Feb 26, 2024 9:25 am

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
Steema Support

Post Reply