Hot Door CORE Forum

Full Version: Radiobutton groups bug
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello. I have encountered a problem with radiobutton groups. I add two radiobutton groups to a single panel. On OSx 10.7 they work as intended - as two groups. But on OSx 10.9+ they work as if they were a single group. Do you have any suggestions on how to fix this problem?
We have not seen this behavior before in any version of OS X. Can you provide an example that exhibits the problem? Perhaps by modifying the sample panel plugin from CORE. For starters, just provide the code necessary to create the radio button objects and their containing groups, as well as adding them to the panel.
Here is code snippet. Am I using the functional correctly?


panel = hdi::core:Tongueanel( "Panel", hdi::core::Size(800, 800), false, false);
hdi::core::RadioButtonGroup units;
hdi::core::RadioButtonGroup axis;

int currentX = 170;
int currentY = 45;
axisOff = hdi::core::RadioButton(hdi::core:Tongueoint(currentX, currentY), "Off", 80);
axisOff.setClickCallback(HDI_CORE_CALLBACK(SettingsDialog, this, OnAxisOffButton));
panel.addWidget(axisOff);
currentY += 20;
axisShowSmall = hdi::core::RadioButton(hdi::core:Tongueoint(currentX, currentY), "Show small", 80);
axisShowSmall.setClickCallback(HDI_CORE_CALLBACK(SettingsDialog, this, OnAxisSmallButton));
panel.addWidget(axisShowSmall);
currentY += 20;
axisShowLarge = hdi::core::RadioButton(hdi::core:Tongueoint(currentX, currentY), "Show large", 80);
axisShowLarge.setClickCallback(HDI_CORE_CALLBACK(SettingsDialog, this, OnAxisLargeButton));
panel.addWidget(axisShowLarge);
axis.add(axisOff);
axis.add(axisShowSmall);
axis.add(axisShowLarge);
axisShowLarge.setChosen(true);

currentY += 84;
unitsInches = hdi::core::RadioButton(hdi::core:Tongueoint(currentX, currentY), "Inches", 80);
unitsInches.setClickCallback(HDI_CORE_CALLBACK(SettingsDialog, this, OnInchesButton));
panel.addWidget(unitsInches);
currentY += 20;
unitsMillimeters = hdi::core::RadioButton(hdi::core:Tongueoint(currentX, currentY), "Millimeters", 80);
unitsMillimeters.setClickCallback(HDI_CORE_CALLBACK(SettingsDialog, this, OnMillimetersButton));
panel.addWidget(unitsMillimeters);
units.add(unitsInches);
units.add(unitsMillimeters);
I have not tried your code yet, but it looks fine at first glance. I will test it soon and get back to you. Thanks.
It appears that Apple made a change in some update of OS X that causes all radio buttons to belong to a group by default, and this (being a platform group) overrides our logical group. I have fixed the bug in our underlying libraries, and the fix will be available in a forthcoming 0.5.7 release.
I just thought I would let you know that 0.5.7 has been released, and it addresses this problem.
This is my project with radio buttons, and I don't understand the unusual behavior. First, if I bounce between the various buttons, occasionally two will be selected. If I do a slow double-click on a button or its text, it will deselect, leaving no buttons chosen. If I do a rapid double-click, it flashes but nothing changes. I thought the group's setDefaultButton function would set the target button as selected when the group first appears, but none are selected unless I explicitly setChosen on a button. Here's the code:

Code:
    hdi::core::RadioButton VHbtn(hdi::core::Point(marginWidth,marginHeight+rowHeight), "Vertical and horizontal", fullLabelWidth);
    VHbtn.setClickCallback(HDI_CORE_CALLBACK(panel::Plugin, this, __VHbtnCB));
    this->__docPanel.addWidget(VHbtn);
    
    hdi::core::RadioButton PrefConstBtn(hdi::core::Point(marginWidth,marginHeight+(rowHeight*2)), "Preferences constrain angle", fullLabelWidth);
    PrefConstBtn.setClickCallback(HDI_CORE_CALLBACK(panel::Plugin, this, __PrefConstBtnCB));
    this->__docPanel.addWidget(PrefConstBtn);
    
    hdi::core::RadioButton DomAxisBtn(hdi::core::Point(marginWidth,marginHeight+(rowHeight*3)), "Object's dominant axis", fullLabelWidth);
    DomAxisBtn.setClickCallback(HDI_CORE_CALLBACK(panel::Plugin, this, __DomAxisBtnCB));
    this->__docPanel.addWidget(DomAxisBtn);
    
    hdi::core::RadioButton CollapseCtlBtn(hdi::core::Point(marginWidth,marginHeight+(rowHeight*4)), "Just collapse control handles", fullLabelWidth);
    CollapseCtlBtn.setClickCallback(HDI_CORE_CALLBACK(panel::Plugin, this, __CollapseCtlBtnCB));
    this->__docPanel.addWidget(CollapseCtlBtn);
    
    hdi::core::RadioButtonGroup BtnGrp;
    BtnGrp.add(VHbtn);
    BtnGrp.add(PrefConstBtn);
    BtnGrp.add(DomAxisBtn);
    BtnGrp.add(CollapseCtlBtn);
    BtnGrp.setDefaultButton(VHbtn);
    VHbtn.setChosen(true);

I'm using Xcode 7 for Mac CS6. My code looks a lot like Gaxx's, but I'm having other issues. Am I doing something incorrectly or is this a bug?
Thanks -- Rick
Hmm, your code looks correct off the top of my head, and we haven't heard of this bug from customers (or seen it ourselves). I wonder what you're doing in your click callback(s) which might be involved in producing this bug? I'll try to have a look at it in our test plugins soon though.