Iterate through ui elements with "index"
So basically I have several of the same ui elements kinda like this:
checkbutton ckb1
checkbutton ckb2
--...
checkbutton ckb32
I want to be able to set properties in-mass. So essentially:
fn massPropertySet =( i=1 while i<=32 do( ckbi.state=false i+=1 ) )
I also want to be able to have a single function that stores data into an array based on button suffix #, but I need to check the state of the button:
on ckb1 changed state do (storeData(1)) on ckb2 changed state do (storeData(2)) fn storeData num = ( if ckbnum.state then( data[num] += <bitArray> else data[num] -= <bitArray> ) --can work around with: on ckb1 changed state do (storeData(1 ckb1.state)) on ckb2 changed state do (storeData(2 ckb2.state)) fn storeData num state= ( if state then( data[num] += <bitArray> else data[num] -= <bitArray> )
I tried storing the checkbuttons in an array but get and unknown system exception...
ckbArray=#(ckb1, ckb2)
So basically I need to be able to store the checkbuttons in an array, which doesn't look possible, or convert a string into a "checkbutton ui name" so I can refer to any checkbutton at will via index.
The latter is possible with scene objects, with the <string> as name
function. Is there a way to do so with ui elements?
Comments
Yes is possible.After you
Yes is possible.
After you define checkburrons you can store it in array.
bga