[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] QRadioButton equivalent in SC?



You can use Button for this functionality pretty easily, as below. Alternatively and with more effort you could dive into the C++ source and implement a wrapper for QRadioButton....

~win = Window().front; 
~butts = 3.collect { |i|
  StaticText(~win, Rect(35, 15 + (20 * i), 200, 20)).string_("Option " ++ i);
  Button(~win, Rect(20, 20 + (20 * i), 10, 10))
  .states_([["", nil, nil], ["", nil, Color.blue]])
  .action_({ |butt| 
    ("Option " ++ i ++ " selected").postln; 
    ~butts.do(_.value_(0)); 
    butt.value = 1 
  });
};
~butts[0].value_(1);

On Thu, Jan 3, 2019 at 3:55 PM <info@xxxxxxxxxxxxxxxx> wrote:

Hey all, I was just wondering if there is any equivalent in SC to the common radio-button interface widget? In Qt this is QRadioButton.

If no such widget exists, are there any ideas on the best way to implement such a thing? I was thinking of subclassing CheckBox.

best

Jon

--
JC Reus

WEB: jonathanreus.com