Recent

Author Topic: [SOLVED] Putting dividing lines in a TListColorBox  (Read 987 times)

Rostelle

  • New member
  • *
  • Posts: 5
[SOLVED] Putting dividing lines in a TListColorBox
« 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
« Last Edit: March 14, 2019, 05:53:21 pm by Rostelle »

howardpc

  • Hero Member
  • *****
  • Posts: 3097
Re: Putting dividing lines in a TListColorBox
« Reply #1 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.

Rostelle

  • New member
  • *
  • Posts: 5
Re: Putting dividing lines in a TListColorBox
« Reply #2 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 ?

lucamar

  • Hero Member
  • *****
  • Posts: 1984
Re: Putting dividing lines in a TListColorBox
« Reply #3 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"
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

Rostelle

  • New member
  • *
  • Posts: 5
Re: [SOLVED] Putting dividing lines in a TListColorBox
« Reply #4 on: March 14, 2019, 05:53:59 pm »
cheers lucamar