[Closed] radioButtons changed state event
hi, i’ve a problem with my radioButtons.
If the initial state is 0 and i’m changing it to 1 in my Rollout, it looks like the event is not responding.
nothing happens.
on rdoAmount chanded state do
(
if state == 1 then
(
0:(OpRollout.rdoRate.state = 1)
1:(OpRollout.rdoRate.state = 0)
)
)
on rdoRate chanded state do
(
case rdoRate.state of
(
0:(OpRollout.rdoAmount.state = 1)
1:(OpRollout.rdoAmount.state = 0)
)
)
both rdo.state == 1
selection of radio buttons starts with 1, if set state to 0, none of buttons will be selected
I noticed it, but in this case, how could i do it?
I used 2 rdo to have more space between my 2 lines
edit: i made the wrong copy of my code. lol
on rdoAmount chanded state do
(
case rdoAmount.state of
(
0:(OpRollout.rdoRate.state = 1)
1:(OpRollout.rdoRate.state = 0)
)
)
on rdoRate chanded state do
(
case rdoRate.state of
(
0:(OpRollout.rdoAmount.state = 1)
1:(OpRollout.rdoAmount.state = 0)
)
)
you have 2 radiobuttons controls with one button in each. Right?
and you want to set state of one control to 0 when another set to 1. Right?
on rb1 changed state do rb2.state = 0
on rb2 changed state do rb1.state = 0
[left][left] [/left][/left]
[left][left]radiobuttons change event calls when the user clicks one of the radio buttons in the set. if you set state of the radiobuttons from the script, change event doesn’t call.[/left][/left]
i already tried it. It’s not working.
are the radiobuttons controls mapped to some parameters in parameter block?
ok. I think so.
in this case you have to use param block events. it will work when you click any mapped radio button or set a value from the stript
ab type:#integer animatable:off default:0 ui:uiA -- mapped to radio b 1
bb type:#integer animatable:off default:1 ui:uiB -- mapped to radio b 2
on ab set val do if val != 0 do bb = 0
on bb set val do if val != 0 do ab = 0
I can’t try it, i returns me an error:
-- Error occurred in anonymous codeblock; filename: E:\Mes Doc\Aespid\MAXScripts\Animation Tools\Animation_Tools_PFS_01\PFCustomTools_Plug_0.1.ms; position: 1
-- Compile error: Specified rollout not found: OpRollout
I think, it's because i create the rollout later:
on ddlOp selected Op do
(
case (classof (getnodebyname PFRollout.ddlOp.selected)) of
(
birth:(
Rollout OpRollout PFRollout.ddlOp.selected
(.....
)
)
)
)
addRollout OpRollout
maybe i haven’t understood this properly, but a set of radio buttons are designed to be off when you change the state of the others, so rather than separating them, have one radiobutton set and span your rollout. Then, when you call the event handler you can control whether to enable UI items.
rollout rdo "" width:150 height:47
(
radiobuttons rdo1 "" pos:[10,5] width:23 height:32 labels:#("", "") default:1 columns:1
spinner spn1 "Tiddly Pum" pos:[49,5] width:91 height:16
spinner spn2 "Wizzy Wee" pos:[49,22] width:91 height:16 enabled:false range:[0,100,0]
on rdo1 changed state do
(
print rdo1.state
case rdo1.state of
(
1:(spn1.enabled = true;spn2.enabled = false)
2:(spn1.enabled = false;spn2.enabled = true)
)
)
)
createdialog rdo
hi ruben,
Im trying to understand the problem, could you explain this a bit more? – the last image doesnt match what you said your problem was in the link you posted above???
ok
If i m using only 1 rdo with 2 columns, the space between them is to small to fit with my spinners. That’s the reason i used 2 of them.
On the image above, i use 2 screen captures to show you the reason of my choice.
I know it would be much easier to use only one. but i don’t like how the rollout looks like. lol.
I don’t know if there’s a way to change the space between the columns???
Even if i would use only one, i still have this problem with my param block as well.