Dangas56
Dangas56

Reputation: 859

Delphi DX Seattle FMX TListView HeaderItem - Hide white Shadow text on non white background

I have noticed that when you change the ListView header background color there is a weird white text like shadow

enter image description here

does anyone know how to get rid of the white shadow?

Steps to reproduce

Create a FMX project, put a list view on it and align it to client
right click on the listview and choose edit custom style
In the lv1style1: TFmxObject find the header structure
enter image description here

select the source link property and move the default selected area to some other color enter image description here

populate the list view on form create - with the code like this

var lvitem : TListViewItem;
begin
  lvitem := lv1.Items.Add;
  lvitem.Text := 'Header';
  lvitem.Purpose := TListItemPurpose.Header;
  lvitem.Detail := '';


  lvitem := lv1.Items.Add;
  lvitem.Text := 'none';
  lvitem.Purpose := TListItemPurpose.None;

  lvitem := lv1.Items.Add;
  lvitem.Text := 'footer';
  lvitem.Purpose := TListItemPurpose.Footer;

if you have any questions please comment below
Any help would be appreciated.

Upvotes: 0

Views: 2966

Answers (2)

Looking at ListView style internals, one may notice, that there is 'headetext' color object. Deducing, that some ListView code should load the color object to reflect the current styling, we may do the search in FMX pas files, and find the following styling code:

  // Item Colors

FStyleResources.DefaultTextColor := GetColorFromStyle('foreground', claBlack); FStyleResources.DefaultTextSelectedColor := GetColorFromStyle('selectiontext', claBlack); FStyleResources.DetailTextColor := GetColorFromStyle('detailtext', claBlack); FStyleResources.HeaderTextColor := GetColorFromStyle('headertext', claWhite); FStyleResources.HeaderTextShadowColor := GetColorFromStyle('headertextshadow', claWhite);

So, there IS an option to control the text shadow color through styles, the style portion controlling it is just not there. Well, adding 'headertextshadow' TColorObject into each corresponding ListView style, and setting its color to Null, would solve your case without any code involved.

Upvotes: 0

Dangas56
Dangas56

Reputation: 859

There was a TextLabel.TextShadowColor setting
On the List view OnUpdateObjects
Added the following code

procedure TForm1.lv1UpdateObjects(const Sender: TObject;
  const AItem: TListViewItem);
var
  TextLabel: TListItemText;
begin
  if AItem.Purpose in [TListItemPurpose.Header, TListItemPurpose.Footer] then begin
    TextLabel := AItem.Objects.TextObject;
    TextLabel.TextShadowColor := TalphaColorRec.Null;
  end;
end;

No Shadow

Upvotes: 4

Related Questions