Cabbage Logo
Back to Cabbage Site

The unlatched button widget's other 1

I was reading something recently about using the metro opcode to ignore the second “1” issued by releasing an unlatched button widget. Search is throwing up nada, anyone got any ideas?

I’m not sure I follow what you are trying to do? Have a button work only once? If so can’t you just use a global variable? I’m sure I’m not getting what you are trying to do. Break it down for me and I can probably provide you with some code to help :wink:

Hi Rory, I’ve stripped down some code for an example. Two widget arrays (rsliders and buttons) are positioned using a UDO. I want to add a reset button (unlatched) to reset the values of the widgets. The problems I’m having are that a single click isnt long enough, so the reset needs to be held down until its cleared. But secondly, moments after the reset, the buttons return to their pre-reset state (rsliders seem fine).
Maybe its just a misplaced 0, or something to do with the recursion… but then the rsliders reset ok…UDO - widget reset test - jk.csd (1.9 KB)

Ok maybe ignore that last post and go with this bit of code instead. Same deal, without the arrays and UDO. Is it not cool to send value(0) to a button to change it’s state to off? Is that identifier just for initialising the widget?
widget reset test - jk.csd (873 Bytes)

I think I’ve sussed it out. I had tried casting 0 as a k variable already, but was sending to the identchannel instead of the channel name itself.

chnset k(0), “button”

Sorted.

Glad you got it sorted. And apologies for the delay. I’m now back in the land of the living, so expect quicker answer from here on in!