[Closed] rolloutCreator addHandler question
I am currently experimenting with how to create dynamic rollouts, and the rolloutCreator is exactly what I have been looking for. I know there is .net but I feel like approaching things this way right now.
Anyway, the question concerns the addHandler part, I’m creating an array of checkbuttons, which I would like to toggle the enable parameter on other arrays of objects created by the same addHandler. But I get “unknown property/undefined” when trying to enable and disable other objects in the codeStr: part of the addHandler.
In other words, what I want is when pressing the T button in this example the corresponding other buttons on the same row becomes enabled.
Here is what I have figured out on my own so far, but obviously the addHandler part at the end is still in error.
rci = rolloutCreator “toggleTest” “Toggle Test” width:130 height:148
rci.begin()
for i in 1 to 5 do
(
rci.addControl #button ((“buttonA_”+(i as string)) as name) (“A”+i as string) paramStr:((“pos:”+[16,(22i)] as string)+(“enabled:false”))
rci.addControl #button ((“buttonB_”+(i as string)) as name) (“B”+i as string) paramStr:((“pos:”+[50,(22i)] as string)+(“enabled:false”))
rci.addControl #checkbutton ((“toggleBtn_”+(i as string)) as name) (“T”+i as string) paramStr:((“pos:”+[84,(22*i)] as string)+(“toolTip:“Toggle””))rci.addHandler ((“toggleBtn_”+(i as string)) as name) #changed paramStr:“theState” filter:true codeStr:((((“buttonB_”+(i as string)) as name) as string)+ “.enable = true”)
)
createDialog (rci.end())
The error says:*Unknown property: “Enable” in ButtonControl:buttonB_1
Now the button should obviously have an enable parameter since I have already set that parameter at the object creation, but somehow I point to the object the wrong way. I’ve been trying different ways but can’t figure it out.
Appreciate any help.
Facepalm. Of course. A bit embarassing I must admit.
Okay, so this works like a charm:
rci.addHandler ((“toggleBtn_”+(i as string)) as name) #changed paramStr:“theState” filter:true codeStr:((((“buttonB_”+(i as string)) as name) as string)+ “.enabled = theState”)
I think there will be more questions later on, but this is a good start. Thank you!