Jump to content

Multi-Radio Button UI Question


denverpotsmoker

Recommended Posts

I have a question about the multi-radio button UI element.

 

In the example:

byte Amount1 = 0; // [1] Delete|Black|White

 

...what does [1] mean?

 

Thanks!

The Rise of the Creative Class

by: Richard Florida

Link to comment
Share on other sites

I suspect it's just a trick to inform the CodeLab code generator that it's a radio button, not a drop-down list. Unfortunately, the default value for radio buttons and list controls seems to always be the first choice, which results in some inelegance when there are two controls with the same choices, but the preferred default is different.

 

EDIT: Actually, the second part of my comment is something of a non sequitur, since the value in braces doesn't determine the default value. I do wish, though, that radio buttons and list controls obeyed the default set by the value the variable is equated to.

Edited by MJW
Link to comment
Share on other sites

I have an idea that would eliminate the need for tricks like that (by replacing it with what I consider to be a better trick), and would allow the the angle control default to be values other than 45. C# has a feature which is similar to C's typedef statements. If at the top of the file you say,

 

using AngleControl = System.Double;

 

AngleControl becomes an alias for double.

 

Then the UI section could have:

 

AngleControl Amount1 = 0; // [0,360] Rotation Angle

 

Unfortunately, for backward compatibility the old methods would still need to work.

 

EDIT: Fixed the command format. I originally forgot the equal sign (too used to typedefs, I suppose),  Changed "double" to "System.Double."  C# doesn't allow "using AngleControl = double;"; "using DoubleVector = PaintDotNet.Pair<double, double>;" works, even though "double" is part of the definition. I'm sure there's a good reason for that.

Edited by MJW
  • Upvote 1
Link to comment
Share on other sites

Thanks for the helpful reply!

 

I wish UI's could be more like real electronics, tho I haven't been too happy with the audio program VST

"realism" look in particular...but it's probably mostly how the controls behave to mouse control. Turning VST knobs

is difficult with a mouse.

 

I was thinking about it today and (I think) a drop-down list is supposed to be like a knob control. You know,

the knob is "inside" the device and each "turn" reveals an option.

 

Judging from the example code, I suppose multi-radio buttons can only have one choice...You know, IF 1 & 2 are selected...

then do something.

 

So I'll probably go with three check boxes (which I think is supposed to be like switches) for my plugin.

 

Thanks again.

The Rise of the Creative Class

by: Richard Florida

Link to comment
Share on other sites

I have an idea that would eliminate the need for tricks like that (by replacing it with what I consider to be a better trick), and would allow the the angle control default to be values other than 45. C# has a feature which is similar to C's typedef statements. If at the top of the file you say,

 

using AngleControl = System.Double;

 

AngleControl becomes an alias for double.

 

Then the UI section could have:

 

AngleControl Amount1 = 0; // [0,360] Rotation Angle

 

Unfortunately, for backward compatibility the old methods would still need to work.

 

EDIT: Fixed the command format. I originally forgot the equal sign (too used to typedefs, I suppose),  Changed "double" to "System.Double."  C# doesn't allow "using AngleControl = double;"; "using DoubleVector = PaintDotNet.Pair<double, double>;" works, even though "double" is part of the definition. I'm sure there's a good reason for that.

That's a great idea.

I have implemented this for the 2.7 release of CodeLab.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...