Lazarus

Using the Lazarus IDE => General => Topic started by: Rostelle on March 03, 2019, 11:16:40 am

Title: [SOLVED] Putting dividing lines in a TListColorBox
Post by: Rostelle on March 03, 2019, 11:16:40 am
I am using a TColorListBox and have ended up with more than sixteen colors to choose from. I was trying to insert a divider line to separate the colors at a logical place but can't work out a way to do it.
I can add a color (deliberately just off-white) and give it a name of (row of minus signs) '------' and then simply ignore the off-white color if it is selected but I wondered if there was a better way ?
All the best
Title: Re: Putting dividing lines in a TListColorBox
Post by: howardpc on March 03, 2019, 05:17:06 pm
AFAIK you cannot do this without subclassing TColorListBox to get access to the DrawItem method.
See attached project for a crude approach which draws lines in code, and sets things up in the form's OnCreate.
 I suspect making it all published and getting it to work satisfactorily in the Object Inspector would be quite a bit more work, but perhaps you don't need that anyway.
Title: Re: Putting dividing lines in a TListColorBox
Post by: Rostelle on March 14, 2019, 03:35:06 pm
howardpc
Apologies for my tardy response
Thanks for your very complete reply including code sample
I have cobbled some of your code into mine and am ploughing on
I am probably being remarkably unobservant but I can't see a mark resolved or mark as useful response option ?
Title: Re: Putting dividing lines in a TListColorBox
Post by: lucamar on March 14, 2019, 04:33:34 pm
I am probably being remarkably unobservant but I can't see a mark resolved or mark as useful response option ?

There isn't any. Just edit your first post and add "[SOLVED]" in the front of the post's "Subject"
Title: Re: [SOLVED] Putting dividing lines in a TListColorBox
Post by: Rostelle on March 14, 2019, 05:53:59 pm
cheers lucamar