[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 586
  • Last Modified:

TRadiobutton and Groupbox

Hi,
under D3 (and WIN98) i create at runtime (!) four different groupboxes (not overlapping) and in each groupbox there are three radiobuttons.
Everytime i click at one radiobutton, it will be checked, but all (!) other radiobuttons turn to "not checked", not only those of the same group.
what is my mistake ??
how can i tell a radiobutton to which group he does belong ?

when i did the same in the D3-Designer, it works correct.

hope for help !
titz
0
titz
Asked:
titz
1 Solution
 
MadshiCommented:
titz,

are you using only the component TRadioGroup or are you grouping TRadioButtons together by yourself?
In both cases make sure that you set the parent property to the right value (probably the form or a panel).
In the second case put all radioButtons that belong to one group on one group panel. So for 4 different groupBoxes you'll have to create 4 panels.
In the first case make sure, you set the "name" property to a senseful setting. If it still doesn't work there's a little trick to find out what you've to do. Create in the designer exactly the situation you want to have. Then right click on the form and select "view as text" (I don't know if that's the name of the menu item I mean; I've the german version). Now look what properties the designer has set and do the same during runtime.
If you still have problems, please post some sources.

Hope this helps... Madshi.
0
 
viktornetCommented:
When you create the radio buttons you need to set the parent.....Here is how....

If you create controls at design time...

YOu need to select the groupbox, and then drop the radio buttons on the groupbox....

if you create the controls at runtime here is how to set the parents.....

var
  i: integer;
  RBtn : TRadioButton;
begin
  for i := 0 to 2 do
  begin
    RBtn := TRadioButton.Create(self);
    RBtn.Parent := MyGroupBox1;
    //Other properties and events
  end;
end;

Regards,
Viktor Ivanov
0
 
titzAuthor Commented:
thanks victor!
regards titz
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now