Hi,
I noticed the following behavior which I'm not able to solve as of yet:
When editing a cell and pressing enter the teegrid scrolls back to the top. It doesn't stay at the same row.
How to reproduce:
1. Place a Teegrid on a form together with a TDatasource and a TClientDataset.
2. Define some fields on the TClientDataSet, right click and choose "Create Dataset".
3. In the code fille the dataset with some rows (more than would fit into the view area of the grid)
4. Scroll to the bottom and edit a cell and press enter (or tab)
5. The grid scrolls to the top
I would expect no scrolling whatsoever after pressing enter.
I'm using a licensed version v1.18 and Delphi 10.4 Version 27.0.38860.1461
See attached for example code and GIF.
Teegrid scrolls to top after editing a cell
Teegrid scrolls to top after editing a cell
- Attachments
-
- ExampleSource.zip
- (1.38 KiB) Downloaded 26 times
Re: Teegrid scrolls to top after editing a cell
Hello,
Just to let you know that we are looking at this issue, the solution to which has eluded us for some time. We'll get back to this thread with feedback.
Regards,
Marc Meumann
Just to let you know that we are looking at this issue, the solution to which has eluded us for some time. We'll get back to this thread with feedback.
Regards,
Marc Meumann
Steema Support
Re: Teegrid scrolls to top after editing a cell
Hello,
This code keeps the current cell location after edit. We'll see what we can do to internalise the technique.
Regards,
Marc
This code keeps the current cell location after edit. We'll see what we can do to internalise the technique.
Code: Select all
var
Form1: TForm1;
scrollPos : TPointF;
hasPainted : Boolean;
procedure TForm1.FormCreate(Sender: TObject);
begin
hasPainted := false;
end;
procedure TForm1.TeeGrid1AfterDraw(Sender: TObject);
begin
if not hasPainted then
Begin
hasPainted := True;
teeGrid1.Rows.Scroll := scrollPos;
teeGrid1.Repaint;
End;
end;
procedure TForm1.TeeGrid1CellEdited(const Sender: TObject;
const AEditor: TControl; const AColumn: TColumn; const ARow: Integer;
var ChangeData: Boolean; var NewData: string);
Var myKey : char;
begin
scrollPos := teeGrid1.Rows.Scroll;
hasPainted := false;
end;
Marc
Re: Teegrid scrolls to top after editing a cell
Thanks, It works a bit better but only if the mouse cursor stays within the area of the grid.
If the mouse cursor is outside of the grid and you use the keyboard to edit values, then a draw event is not triggered and the grid goes again to the top but stays there.
If that can be fixed then it should be fine.
Cheers,
Ronald
If the mouse cursor is outside of the grid and you use the keyboard to edit values, then a draw event is not triggered and the grid goes again to the top but stays there.
If that can be fixed then it should be fine.
Cheers,
Ronald