Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide border around TRadioGroup

I have two radiobuttons in a TRadioGroup. All the logic behind how they are supposed to work is fine. But the TRadioGroup controler has a frame around it that I thought I would be able to delete using a border property or something like that. But the control doesn't seem to have any property that bears any resemblance to a border/frame. How do I set the controler to not include a frame?

like image 547
inquam Avatar asked Sep 15 '11 11:09

inquam


2 Answers

TRadioGroup does not support what you are looking for. Place two TRadioButton components onto a TPanel instead. Then you can make it look how you want.

like image 156
Remy Lebeau Avatar answered Oct 18 '22 16:10

Remy Lebeau


I don't think you can hide the border on a standard radio group box. It looks like you could create a custom descendant and override the painting if drawing normally, but that approach could be a bit more involved with theme support. Overall it sounds like a lot of work to go that route.

The next most obvious approach is to replace the radio group with a number of individual radio buttons on a container such as a panel. That would work and would be simple code but it could get messy. It seems a lot of busy work for little gain and I am lazy enough to look for another option.

There is a kludge you can use. If you put the radio group on a panel rather than directly onto the form (or other background) you can make the panel under-sized compared to the radio group. You want the panel to be as big as the interior of the radio group but not as big as the border. Then set the top and left of the radio group to negative numbers so that the border falls outside the parent panel. The border is not visible this way.

like image 37
Glen Morse Avatar answered Oct 18 '22 16:10

Glen Morse