[w10 x64 v14630] Bug and/or RFE: setting panel.radio to "unclick" whichever exclusive button

So maybe I’m just crazy, but I thought it used to be possible to set the panel.radio value of a container that had radio or exclusive buttons in it to change the radio state of the buttons in that container.

The specific example would be a container with exclusive buttons where I could “unclick” whichever exclusive button happened to be active (if any) by just doing:

op('container_buncha_buttons').panel.radio = -1

Without knowing which button was already clicked, and also avoiding toggling on an exclusive button if none currently are clicked.

I swear I’ve done this before, I just can’t find an old file with any proof. Maybe not with that exact python, but there was some one-liner that did this, maybe also like op('container_buncha_buttons').click(-1)? But that seems less obvious since .click() is just for setting state and not radio.

If it’s not a bug and I’m just crazy, please feel free to move this to RFEs. Thanks!

Hey @Peeet

So n.panel.radio will set the value but not update visually. The panel will not react.

You’ll have to use an Exclusive mode.

You can set using n.clickChild(2), as an example, which would toggle the 2nd button.

Now with n.panel.radio you would know which button is currently on (should return 2 in that case). To untoggle it you can then use n.clickChild(n.panel.radio).

Does this help?

Best,
Michel

1 Like

Interesting, that’s pretty good hack (using the radio value itself), only problem I find is that if no exclusive button is already clicked, then this throws an error.

BUT it did lead me to another python thing in containers:

while you can’t set an absolute state with n.clickChild(index), you CAN set an absolute state with the regular n.click(state) method. Combine that with n.panelChildren[] and you can do n.panelChildren[0].click(0) which “unclicks” whatever the first exclusive button is inside that container n. This will always deselect all exclusive buttons without having to know if any / which one is “clicked” and won’t throw any errors if it’s already unclicked. and since you will presumably always have at least one button, using panelChildren[0] should always resolve to a valid object…

Unless, like in my case, you have a hidden button inside the container acting as a replicator master, in which case clicking on it will give unexpected results (similar to setting panel.radio to 0). So I just used n.panelChildren[1].click(0) since I know there will always be TWO buttons in there - the master for the replicator and at least one displayed skin job.

Thus, it would seem clickChild() does NOT count buttons with par.display not toggled on in it’s index, whereas panelChildren[] does…

Thanks for leading me down the right path! I still could’ve sworn I’ve done this in the past by just setting panel values, but I digress.