Firemonkey styles – duplicate a certain style lookup to customize

  

In a Firemonkey project, I have a TListBox with numerous items. Depending on the state of any given item, I intend to show the Detail as either red or white (on a black background). Of course I need to use the styles to do this.

I right-click one of the TListBoxItem controls and choose “Edit Custom Style…”. It’s my understanding that it’s supposed to produce a new copy of whatever the current style lookup is just for this one control. In my case, I had already set it to listboxitemrightdetail prior to trying to customize it. What I would expect is that when I make a change to the font color in this style and “Apply and Close”, that one single list box item should get that change.

However, instead of that one, ALL of the items in this list box got that change. The change I made actually modified the listboxitemrightdetail rather than producing a copy of it just for that one control.

In the end, I intend to have two style lookups, for example listboxitemreddetail and listboxitemwhitedetail which I can toggle on each list item in runtime.

What am I doing wrong, and what’s the appropriate way to duplicate a style lookup to have two different versions?

Comments are closed.