@@ -1511,7 +1511,7 @@ struct RadioComponent : public GUIComponent
15111511{
15121512 int lastState = 0 ;
15131513
1514- Value minimum = Value( 0 . 0f ), maximum = Value(8 .0f );
1514+ Value numButtons = Value(8 .0f );
15151515
15161516 bool isVertical;
15171517
@@ -1522,6 +1522,8 @@ struct RadioComponent : public GUIComponent
15221522 initialise (newObject);
15231523 updateRange ();
15241524
1525+ numButtons.addListener (this );
1526+
15251527 int selected = getValueOriginal ();
15261528
15271529 if (selected < radioButtons.size ())
@@ -1582,10 +1584,7 @@ struct RadioComponent : public GUIComponent
15821584
15831585 void updateRange ()
15841586 {
1585- minimum = gui.getMinimum ();
1586- maximum = gui.getMaximum ();
1587-
1588- int numButtons = int (maximum.getValue ()) - int (minimum.getValue ()) + 1 ;
1587+ numButtons = gui.getMaximum ();
15891588
15901589 radioButtons.clear ();
15911590
@@ -1607,8 +1606,9 @@ struct RadioComponent : public GUIComponent
16071606 };
16081607 }
16091608
1610- box->resized ();
1611- resized ();
1609+ radioButtons[(int )gui.getValue ()]->setToggleState (true , dontSendNotification);
1610+
1611+ box->updateBounds (false );
16121612 }
16131613
16141614 OwnedArray<TextButton> radioButtons;
@@ -1621,19 +1621,14 @@ struct RadioComponent : public GUIComponent
16211621
16221622 ObjectParameters defineParameters () override
16231623 {
1624- return {{" Minimum " , tInt, cGeneral, &minimum, {}}, { " Maximum " , tInt, cGeneral, &maximum , {}}};
1624+ return {{" Options " , tInt, cGeneral, &numButtons , {}}};
16251625 }
16261626
16271627 void valueChanged (Value& value) override
16281628 {
1629- if (value.refersToSameSourceAs (min ))
1629+ if (value.refersToSameSourceAs (numButtons ))
16301630 {
1631- gui.setMinimum (static_cast <float >(min.getValue ()));
1632- updateRange ();
1633- }
1634- else if (value.refersToSameSourceAs (max))
1635- {
1636- gui.setMaximum (static_cast <float >(max.getValue ()));
1631+ gui.setMaximum (static_cast <int >(numButtons.getValue ()));
16371632 updateRange ();
16381633 }
16391634 else
0 commit comments