Prev: expm
Next: array manipulation
From: Mark Proulx on 24 Jun 2010 13:04 Consider a situation where a GUI includes a pushbutton that executes some code associated with a callback function that is nested in the GUI function. Does there exist a mechanism that would allow one to execute the callback code via an external command so that the callback executes as though the button had actually been pushed?
From: Walter Roberson on 24 Jun 2010 15:30 Mark Proulx wrote: > Consider a situation where a GUI includes a pushbutton that executes > some code associated with a callback function that is nested in the GUI > function. Does there exist a mechanism that would allow one to execute > the callback code via an external command so that the callback executes > as though the button had actually been pushed? Yes, just call the routine with appropriate parameters. mybuttoncallback(button_handle, [], arg1, arg2, ...)
From: us on 24 Jun 2010 15:46 "Mark Proulx" <mark.p.proulx(a)boeing.com> wrote in message <i00366$eii$1(a)fred.mathworks.com>... > Consider a situation where a GUI includes a pushbutton that executes some code associated with a callback function that is nested in the GUI function. Does there exist a mechanism that would allow one to execute the callback code via an external command so that the callback executes as though the button had actually been pushed? one of the solutions % simply call the callback function like any other function... % BUT: don't forget the two ...hidden... parameters, H,E h=[]; % -or- if your callback wants a graphics obj, eg, h=gca; acallback(h,[],your_input1,...,your_inputN); us
From: Mark Proulx on 24 Jun 2010 15:52 Walter Roberson <roberson(a)hushmail.com> wrote in message <i00btk$dst$1(a)canopus.cc.umanitoba.ca>... > Mark Proulx wrote: > > Consider a situation where a GUI includes a pushbutton that executes > > some code associated with a callback function that is nested in the GUI > > function. Does there exist a mechanism that would allow one to execute > > the callback code via an external command so that the callback executes > > as though the button had actually been pushed? > > Yes, just call the routine with appropriate parameters. > > mybuttoncallback(button_handle, [], arg1, arg2, ...) As always, thanks for the response. This is the approach I'm trying, but for some reason, it isn't working. ML responds with an "undefined function or method..." error, as though the callback function is out of scope. I will continue to work this...
From: Walter Roberson on 24 Jun 2010 15:55
Mark Proulx wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <i00btk$dst$1(a)canopus.cc.umanitoba.ca>... >> Mark Proulx wrote: >> > Consider a situation where a GUI includes a pushbutton that executes >> > some code associated with a callback function that is nested in the >> GUI > function. Does there exist a mechanism that would allow one to >> execute > the callback code via an external command so that the >> callback executes > as though the button had actually been pushed? >> >> Yes, just call the routine with appropriate parameters. >> >> mybuttoncallback(button_handle, [], arg1, arg2, ...) > > As always, thanks for the response. This is the approach I'm trying, > but for some reason, it isn't working. ML responds with an "undefined > function or method..." error, as though the callback function is out of > scope. I will continue to work this... Is it possible that it is a nested routine and you are trying to call it from outside of the nest? If so then you will have to somehow locate the button handle, probably using findobj() with an appropriate set of criteria. h = findobj('Type','uicontrol','Style,'pushbutton','Tag', 'Here_I_am'); then cb = get(h,'Callback'); cb{1}(h, [], cb{2:end}); |