ScriptSpot

Forum topic · General Scripting

Radio Buttons - Spacing

By JokerMartini · 2010-08-29

Description

I was wondering if you knew a way to control the vertical spacing of radio buttons in a single column?
I've noticed in some of the max UI for instance in the Preferences Rendering tab that in the Field Order the vertical spacing is larger than other parts of the UI using radio buttons.
Help would be great. Thanks
John Martini

Comments (5)

try this instead

JokerMartini · 2012-05-08


try(destroyDialog ::rlRB)catch()

rollout rlRB "Vertical"
(
fn fnOpt idx= (
range = #(rlRB.rbA, rlRB.rbB, rlRB.rbC)
for o in range where idx != o do
(
o.state = 0
)
)

label lbTypes "Types:" pos:[10,10]
radiobuttons rbA "" labels:#("A") pos:[60,10] default:1
radiobuttons rbB "" labels:#("B") pos:[60,40] default:0
radiobuttons rbC "" labels:#("C") pos:[60,90] default:0

on rbA changed state do (fnOpt rlRB.rbA)
on rbB changed state do (fnOpt rlRB.rbB)
on rbC changed state do (fnOpt rlRB.rbC)
)
createDialog rlRB 150 150

barigazy · 2012-05-08

Very nice, John.
Now it's works.
I avoid to use radiobuttons ctrl, instead,
I use checkboxes that mimic the behavior of radiobuttons.
Anyway, thanks for sharing this interesting solution.

SOLUTION!

JokerMartini · 2012-05-08


try(destroyDialog ::rlRB)catch()
rollout rlRB "Vertical"
(
local range = #(rlRB.rbA, rlRB.rbB, rlRB.rbC)

fn fnOpt idx= (
for o in range where idx != o do
(
o.state = 0
)
)

label lbTypes "Types:" pos:[10,10]
radiobuttons rbA "" labels:#("A") pos:[60,10] default:1
radiobuttons rbB "" labels:#("B") pos:[60,40] default:0
radiobuttons rbC "" labels:#("C") pos:[60,90] default:0

on rbA changed state do (fnOpt rlRB.rbA)
on rbB changed state do (fnOpt rlRB.rbB)
on rbC changed state do (fnOpt rlRB.rbC)
)
createDialog rlRB 150 150

barigazy · 2012-05-08

I don't know but something is wrong.
When i run tour code max throw this error:

-- Error occurred in anonymous codeblock; filename: D:\...; position: 549; line: 22
-- Unknown property: "rbA" in undefined

Anubis · 2010-08-29

I also wondered can I do this. Definitely no such feature available. I suspect that its possible (because we can set the state of radio buttons to 0 to deselect) to accomplish this with multiple rbuttons using separate rbutton for each label, but so far I have not tested it.