View Full Version : radioButtons changed state event
holycause 07-19-2009, 09:47 PM 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
|
|
denisT
07-19-2009, 09:56 PM
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
holycause
07-19-2009, 10:21 PM
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)
)
)
denisT
07-19-2009, 10:37 PM
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
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.
holycause
07-19-2009, 10:46 PM
i already tried it. It's not working.
http://aespid.com/Perso/MS/rdo_Problem/rdo_Problem.html
denisT
07-19-2009, 11:19 PM
i already tried it. It's not working.
http://aespid.com/Perso/MS/rdo_Problem/rdo_Problem.html
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
holycause
07-20-2009, 01:33 PM
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
LoneRobot
07-20-2009, 02:19 PM
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
holycause
07-20-2009, 05:11 PM
i used 2 rdo, to fit with the ui
http://aespid.com/Perso/MS/PF_Prob_01.jpg Left: 2 rdo - Right: only one
LoneRobot
07-20-2009, 10:01 PM
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???
holycause
07-20-2009, 10:40 PM
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.
floopyb
07-21-2009, 04:33 AM
Wouldnt you have to call the "changed" function of the control when you set a state internally? I think i remember having to do that in a script, not sure if it relates to your problem though.
eg:
on rdoAmount chanded state do
(
case rdoAmount.state of
(
0:(OpRollout.rdoRate.state = 1)
1:(OpRollout.rdoRate.state = 0)
)
OpRollout.rdoRate.changed state
)
on rdoRate chanded state do
(
case rdoRate.state of
(
0:(OpRollout.rdoAmount.state = 1)
1:(OpRollout.rdoAmount.state = 0)
)
OpRollout.rdoAmount.changed state
)
although i do feel an infinite loop coming on :)
LoneRobot
07-21-2009, 07:02 AM
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)
)
)
it couldnt be something as simple as the the fact your event is spelt wrong?
holycause
07-21-2009, 04:16 PM
lol. I can't believe in it. I'm such an (bip).
but i don't know how to access my Rollout in the parameters block
denisT
07-21-2009, 05:47 PM
lol. I can't believe in it. I'm such an (bip).
but i don't know how to access my Rollout in the parameters block
to access rollouts from param block you have to now just a name of rollout and call
-- name of rollout is "myRollout" for example
this.myRollout
same way you can get access to any control of any rollout...
PS. chanded - is THE BUG of the week!
holycause
07-21-2009, 07:03 PM
PS. chanded - is THE BUG of the week!
Sure, Bobo should add it into the help file. LOL
Ok i think it works now.
before, i used this structure:
plugin
(
parameters
()
Rollout MainRollout
(
on ddlX selected itm do
(
Rollout OpRollout
()
addRollout OpRollout
)
)
)
and now i'm doing it like this;
plugin
(
parameters
()
Rollout MainRollout
(
on ddlX selected itm do
(
RemoveRollout OpRollout
addRollout OpRollout
)
)
Rollout OpRollout
()
)
CGTalk Moderation
07-21-2009, 07:03 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.