Callbacks for uicontrols automatically have two parameters added to the beginning of the argument list: the object being worked on, and "event" data about it. You have only defined a single parameter as being valid.
If you were to extend the argument list for "test" to
function test(val, event)
then that part would not fail, but the argument being passed in for "val" would be the object, not the value "k" that you created in "hide".
Your statement
inside hide() is going to be executed immediately after the uicontrol gets created, and so would pass the initial Value of the uicontrol to the routine "test"; that get() is not going to be delayed until the callback is triggered. There can be good reasons to call a callback within the routine that creates the control, but when you do so you need to pass in parameters just as if the callback had been triggered by the user.
Best Answer