0

I have a TabControl with Two TabItem. Each tabItem has a ListView in it. The OnItemClick event of the listView on the first TabItem execut a 'NextTabAction'.

The problem is that if I select an item in the listView on the second TabItem, its TextColor is White instead of Black. The bug seems to be that if a ListView is on a TabItem that is not the one visible when the application starts, its selectedItem's TextColor will be White.

It is pretty simple to reproduce. I'm using Delphi Tokyo 10.2

If the page is visible on startup, then it looks this way TextColor Black

If the page is not visible on startup, then it looks this other way enter image description here

Is there a way to solve this?

Federico Pessina
  • 199
  • 1
  • 4
  • 15
  • FWIW, I cannot reproduce on a Win 7 machine with neither Delphi XE7 nor Delphi 10.1 Berlin. I don't have Delphi 10.2 Tokyo installed at all. Do you have update 3 installed? – Tom Brunberg Jun 09 '18 at 05:44
  • I have Delphi 10.2 Tokyo with no update installed. Could installing updates solve the problem? – Federico Pessina Jun 11 '18 at 06:20
  • I can't say for sure. Most problems in 10.2 have been corrected, but I don't know if this particular problem is fixed. The latest version is 10.2 update 3. – Tom Brunberg Jun 11 '18 at 06:53

1 Answers1

1

This is ordinary behavior for ListView even in Delphi 10.2 update 3. It happens only when you use tab transitions.

I fix this issue with the below code:

procedure TForm1.ListView1UpdateObjects(const Sender: TObject; const AItem:  TListViewItem);
var
  Text: TListItemText;
begin
  Text := TListItemText(AItem.View.FindDrawable('T'));
  if Text <> nil then
    Text.SelectedTextColor := TAlphaColors.Black;
end;

Of course you need to change Drawable name corresponding to your needs...

dustypup
  • 154
  • 5