When you Add a button to a TAdvOfficeRadioGroup all the existing button “Enabled” properities are set to true (maybe other properties are also reset). This is not how the VCL TRadioGroup works so I guess it is fair to call it a “Bug” rather than a "Feature".
For TAdvOfficeRadioGroup this enables all 4 buttons.
rgAdv.ClearRadioButtons;
rgAdv.Add('RB1');
rgAdv.RadioButtons[0].Enabled := false;
rgAdv.Add('RB2');
rgAdv.Add('RB3');
rgAdv.RadioButtons[2].Enabled := false;
rgAdv.Add('RB4');
For VCL TRadioGroup this correctly disables RB1 and RB3:
rgVCL.Items.Clear;
rgVCL.Items.Add('RB1');
rgVCL.Buttons[0].Enabled := false;
rgVCL.Items.Add('RB2');
rgVCL.Items.Add('RB3');
rgVCL.Buttons[2].Enabled := false;
rgVCL.Items.Add('RB4');
Setting the Enabled property after adding all the buttons works OK, so there is a simple work around.
This can't be the TAdvOfficeRadioGroup as-is as it has no ClearRadioButtons nor Add() method.
Are you referring to another control or did you do own modifications to TAdvOfficeRadioGroup?
Maybe he’s using a class helper, but In effect, in ``TCustomAdvOfficeRadioGroup.UpdateButtons`` all buttons Enabled property are reset to the radiogroup’s Enabled property.
The designed way to disable individual radiobuttons or checkboxes is via event handler OnIsEnabled.
Accessing the buttons directly is also convenient and caused indeed an issue with adding the buttons this way in code one by one.
We applied an improvement in TAdvOfficeRadioGroup & TAdvOfficeCheckGroup so this is also in these circumstances working as expected. Next TMS VCL UI Pack release will have this improvement.
Hi Bruno - yes I do use a class helper to add a bit of simplicity to my code, but it is the tAdvOfficeRadioGroup I am using. Thanks for the fix.
And thanks to the steer to OnIsEnabled - this is eactly what I should be using!