You are right it does unnecessarily restrict the layout of the buttons. The following structure is probably incorrect but the gist of it may be an option:

<BoxPane>

  <RadioButton wtkx:id="oneButton" buttonData="One" selected="true"/>
  <RadioButton wtkx:id="twoButton" buttonData="Two" />
  <RadioButton wtkx:id="threeButton" buttonData="Three" />

  <ButtonGroup wtkx:id="numbersGroup">
     <ButtonGroupItem button="$oneButton" />
     <ButtonGroupItem button="$twoButton" />
     <ButtonGroupItem button="$threeButton" />
  </ButtonGroup>

  <PushButton wtkx:id="selectButton" buttonData="Select"/>

</BoxPane>

Sure, something like that is theoretically possible (if Button.Group implemented Sequence, and we defined a ButtonGroupItem class that served as a means to dereference button IDs). But do you really think that is more readable than this?

<RadioButton wtkx:id="oneButton" buttonData="One" selected="true" buttonGroup="numbersGroup"/> <RadioButton wtkx:id="twoButton" buttonData="Two"buttonGroup="numbersGroup"/> <RadioButton wtkx:id="threeButton" buttonData="Three"buttonGroup="numbersGroup"/>

I don't.

Of course if it was possible to automatically generate an object of
Button.Group from the currently used syntax, that could be accessed via the WTKXSerializer.get() method or @WTKX annotation, then it would save all that typing ;-)

Did you try declaring your group in a <wtkx:define> block and setting it on the radio buttons like this?

<wtkx:define>
        <Button.Group wtkx:id="numbersGroup"/>
</wtkx:define>

<RadioButton wtkx:id="oneButton" buttonData="One" selected="true" buttonGroup="$numbersGroup"/>

Then you can bind to it if you want.

Reply via email to