TCRDBGrid selected line display after TitleClick

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Adonis
Posts: 2
Joined: Mon 28 Nov 2011 11:00

TCRDBGrid selected line display after TitleClick

Post by Adonis » Mon 28 Nov 2011 11:16

Hello,
We have Delphi XE 2 with Odac 8.0.2.
We have a TCRDBGrid in a Dialog form used to display a list.
We have 4 columns in this grid.
We can sort the columns with a click on the title.
We have properties dgRowLines, dgRowSelect set to true.
when we click in the grid, we have an entire row selected.
When we sort with a click on a column, the blue line (selection) is moved to the bottom of the list, with the row.

Is it possible to keep the first line blue when we sort the lists ?
(keep the 1st line selected after a sort ?)

Thanks

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 28 Nov 2011 12:44

Hello,

For the cursor to stay on the first line after performing sorting in TCRDBGrid, you can use the CRDBGrid.OnTitleClick event in which you can call the First method:


procedure TForm1.CRDBGrid1TitleClick(Column: TColumn);
begin
OraQuery1.First;
end;

But the existing behaviour is more correct, because the cursor always stays on the selected record.

Adonis
Posts: 2
Joined: Mon 28 Nov 2011 11:00

Post by Adonis » Mon 28 Nov 2011 15:10

Thanks Alex P, it works well !!

It was a request of a customer, that's why we needed this behaviour !

Post Reply