Jump to content

Overriding TW3ListBoxItemData style


Recommended Posts

@lennart, @jarto

Testing the latest update, I am trying to override the TW3ListBoxItemData's "RemoveSelectedStyle" and "SetSelectedStyle" methods.

However,  I can't seem to get the StyleClass property to work. However, I can do color changes at runtime.

 

procedure TXListBoxItemData.RemoveSelectedStyle;
begin
  //TXListBoxItem(ItemObject).StyleClass:= 'XListBoxItemStyle';  //does not work
  //TXListBoxItem(ItemObject).Label.StyleClass:= 'XListBoxItemStyle'; //does not work

  TXListBoxItem(ItemObject).Label.Color:= clWhite;  //works
  TXListBoxItem(ItemObject).Label.Font.Color:= clBlack; //works
end;

procedure TXListBoxItemData.SetSelectedStyle;
begin
  //TXListBoxItem(ItemObject).StyleClass:= 'XListBoxItemSelectedStyle';  //does not work
  //TXListBoxItem(ItemObject).Label.StyleClass:= 'XListBoxItemSelectedStyle';  //does not work
 

TXListBoxItem(ItemObject).Label.Color:= clBlack;  //works
  TXListBoxItem(ItemObject).Label.Font.Color:= clWhite; //works
end;

 

It seems that the StyleClass will not happen instaneously.  Is there a method that has to be called after setting StyleClass to get it to refresh immediately? When I select an item, I do not see the Style change until I select another item, then the previous item I selected, changes

Download from Github

Thanx

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...