Recent

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

Rostelle

  • Newbie
  • 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: 4144
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

  • Newbie
  • 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: 4219
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/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Rostelle

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

 

TinyPortal © 2005-2018