"squirreltown" wrote:
"belltown" wrote:
butts = []
button={title:"RUN DEMO" , action:AutoPaint, sec:"demo", params:{param1: arg1, param2: arg2}} : butts.Push(button)
butts[index].action(butts[index].params)
Rats. I tried that and it didn't work, it threw "wrong # of Func params" here:butts[index].action(butts[index].params)
and not at the Line# of the function it's calling which does have 2 parameters.
That aside, the function parameters (inside the parenthesis) should accept some sort of AA?
'action' only takes one param, an associative array. You'd need to extract the AA key values within 'action':
function action (params as object) as void
p1 = params.param1
p2 = params.param2
' etc ...
end function
If you wrap the parameters in an AA, you can have as may as you want without changing the call to 'action'; just add them to the 'params' AA when you set up your buttons, and write whatever code you need in 'action' to handle them.