Now that I am changing functions activated by button calls on the fly, I am currently thinking the cleanest way to do this is:
Code: Select all
function MyButtonActionFunction(msg)
switch msg.action
case "OnMouseDown":
MyLeftMouseDownFunc()
case "OnRightMouseDown":
MyRightMouseDownFunc()
...
endswitch
endfunction
And this is what i basically use on any button, that regardless what event triggered, it is always going to that one and same function dedicated for that buttons action events so it can call the appropriate function that i can change on the fly.
Therefore, it would be nice to have on that Makebuttons event part "OnAnyEvent" possibility, for now that I am always calling the same function, it is slightly annoying to:
Code: Select all
MakeButton(NIL, #SIMPLEBUTTON, 100, 100, 200, 200 {OnMouseDown = samefunc, OnRightMouseDown = samefunc, OnMiddleMouseDown = samefunc, OnMouseUp = samefunc, OnRightMouseUp = samefunc...})
when it could be done:
Code: Select all
MakeButton(NIL, #SIMPLEBUTTON, 100, 100, 200, 200 {OnAnyEvent = samefunc})
Although the drawback is that this MyActionButtonFunc would be called on every possible event, I dont think that is such a big deal, since if all my Function does is to check which action it is and then switch to corresponding action to execute corresponding function meant for it, I dont think it would really take that much resources even it would everytime come and execute that even when unnecessary.