Forum > LCL

Radiobox "Owner Drawn"

(1/3) > >>

Nicole:
I want my Radiobox "formatted".
e.g. (I write asterix for a circle)

NOT:
* item1
* item2
* item3
* item4
* item5

BUT:

header1
* item1
* item2

header2
* item3

header3
* item4
* item5

I tried this type TRadiogroupbox (not sure about the name), which looks good, but does not work exactly alike a TRadiobox. And I tried to use "empty" items and deactivate them. It does not look nicely under the line.

Any ideas?

Arioch:
1. Use regular TGroupBox or TPanel or TNotebook - any container

2. Select a component for headers - can be anything which look you would like. Customized TLabel, TStaticText, Tpanel, TEdit in read-only mode, anything.

3. drop it in and set .Align to alTop and then tweak .BorderSpacing to make margins look good. Also, set font size, color, whatever you would want.

4. drop TRadiobutton, set .Align to alTop and then tweak .BorderSpacing - so it would look more (or less) indendted than header components.

keep doing it until all the headers and radiobuttons are in

P.S. After them all populated, you might want to play with GroupBox's property ChildSizing.EnlargeVertical

P.P.S. This should make all radiobuttons to "see" each other and only let single one turned on across all the headers. If you want every "header" to have a separate group - you would have to add a TPanel after headers, set it Bevels and Borders to none, and place radiobuttons inside that panel

KodeZwerg:
If each "header/item"-thing shall be useable, i'd suggest to write a small class for that purpose that create a panel top-aligned text and a variable amount of radio-buttons...

jamie:
There are options:

   1.TTreeView is one. It's customizable and natural for indenting etc.

   2. TVirtualstring is another. that allows you to customize the display because you have to draw it anyways.

   3. Multiple group boxes on a TscrollBox.
 
   4. TPanel and implement the paint cycle to place radio marks on the surface using Icons etc.

 
 The list goes on. I've been there and done that ! :o

Arioch:

--- Quote from: jamie on September 27, 2022, 01:21:56 am ---   1.TTreeView is one. It's customizable and natural for indenting etc.
   2. TVirtualstring is another. that allows you to customize the display because you have to draw it anyways.
   3. Multiple group boxes on a TscrollBox.

--- End quote ---

Those would create isolated groups, with each group having their own selected item, won't it?
Sure, it can be overriden using events, but why fight problems that we can avoid creating...

I might be reading mind wrongly, but to me the items numbering used by the TS suggests she wants "global" checkboxes, that work "over" headers rather than being contained by them.

Navigation

[0] Message Index

[#] Next page

Go to full version