Cabbage Logo
Back to Cabbage Site

Can a button return something other than 1/0?

I’m looking to create a series of buttons that select an operation, but in order to do that, I was hoping that a button could be made to return either a zero or something other than one. If I could set it at creation trying for it to return something like 37, I could use that as an index to select my operation based on that.

I’m trying to figure a way to call up a part of a gui (ie make those widgets visible), and I figured I could do this if I could have each button return a unique value when clicked.

I was thinking more about this and of the custom identifiers functionality could return the value passed…

image bounds(0, 0, 100, 16) channel(“myimg”) _data(169)

kVal cabbageGet “myimg”, “_data”

And now kVal would be set to 169…

Or no? Sorry about the formatting, I’m on my phone…

OK, checked it out… this will return the number passed. So, this is what I need to get started. Thanks!

That’s a nice solution. Another way would be to use an array, and then look up that values you need. Something like this

kArr[] fillarray 37, 169
kVal = kArr[cabbageGetValue:k(“myimg”)]