Colouring the selected row and hovering and alternate

I have been trying to get colouring to work in TeeGrid for the selected row and for alternate rows, as well as for hovering over a row but none of this seems to work as expected by setting values in the designer.

I have also noted that, to get the selected row to show its colour, I need to right-click somewhere in the TeeGrid first at runtime, then it works until I right-click again

Using Delphi 13 with FMX and the latest TeeGrid

Hello,

This demo helps with a look at alternating rows. Checkout the TiOSTheme and TAndroidTheme for examples of it setup.

Themes demo

ie. Tee.Grid.Themes

class procedure TiOSTheme.ApplyTo(const AGroup: TRowGroup);
....
  AGroup.Rows.Alternate.Visible:=True;
  AGroup.Rows.RowLines.Visible:=False;

Re. " to get the selected row to show its colour, I need to right-click"
If there’s some setup tips you can pass over to help reproduce the issue please let us know, I can’t see that happening in the linked demo.

With thanks.
Regards,
Marc

Marc
attached is a simple example. I found, in writing this, that there was something unusual in the way my TeeGrid was behaving but I could not see anything wrong with the definitions. So, I deleted it and added a new item which has resolved most of the issues I was asking about. There is still, however, one aspect that does not work as I would expect.

If one wants ScrollToView to work, then one has to first click in the TeeGrid to activate a Selected row. I would expect ScrollToView to work irrespective of whether a row is selected or not, assuming one has an Indicator defined.

One can see this behaviour with the test example. If one just starts stepping down the list of records using only the TNavigator, then one can scroll past the end of the visible list and keep going without the current record remaining visible in the TeeGrid. If one first clicks somewhere in the TeeGrid, this activates Selected and ScrolltoView behaves as expected.

I would also have expected Selected to refer to whichever record was the current record during initial FormShow i.e. to be the same as the row shown by the Indicator in this example.

Thanks

Bruce
tsttg.zip (140 KB)

Hello Bruce,

Thank you for the test project. We are looking for a solution to this.

Regards,
Marc

Thanks. Always good to be able to contribute to improvement in some small way

Hello Bruce,

An improvement has been applied for this issue, that will be included with the next TeeGrid update.

In the meantime, it could be applied to current TeeGrid code in this way:

replace the method, CheckScroll, in TeeGrid.pas, with:

procedure TCustomTeeGrid.CheckScroll(const ASelected:TGridSelection);
begin
  if (ASelected.Column<>nil) and Root.CanScroll(True) then
     CheckHorizScroll(ASelected.Column);

  if Root.CanScroll(False) then
     if ASelected.Row<>-1 then
        CheckVertScroll(ASelected.Row);
end;

..then recompile TeeGrid with TeeGridRecompile.exe and load modified packages to the IDE.

Regards,
Marc