How can I set a GUI callback such that it uses the up-to-date handles structure as an input variable?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Marc Lalancette
el 9 de Dic. de 2013
Comentada: Marc Lalancette
el 10 de Dic. de 2013
Hello, I'm trying to have users navigate a plot by clicking on it. However, another 3-d plot is in "rotate" mode so I've had to use the workaround of turning off listeners and resetting the KeyPressFcn:
hManager = uigetmodemanager(hObject); % hObject is my GUI figure.
set(hManager.WindowListenerHandles, 'Enable', 'off');
set(hObject, 'KeyPressFcn', @figure_NiftiViewer_KeyPressFcn);
Unfortunately, I can't figure out how (or if it's possible) to reset the callback to it's default GUIDE "way", where it would have the "handles" structure as an input argument. If I explicitly give it these ways, it doesn't get updated:
set(hObject, 'KeyPressFcn', {@figure_NiftiViewer_KeyPressFcn, handles});
set(hObject, 'KeyPressFcn', {@figure_NiftiViewer_KeyPressFcn, guidata(hObject)});
And unfortunately, if you look at what's displayed in the figure properties in the property inspector, it's:
NiftiViewer('figure_NiftiViewer_KeyPressFcn',hObject,eventdata,guidata(hObject))
which doesn't seem like a "valid" function (I tried putting that in and it gave an error).
So is there a way to manually make this callback act the same way GUIDE makes it act?
Thanks!
0 comentarios
Respuesta aceptada
Walter Roberson
el 10 de Dic. de 2013
Try
set(hObject, 'KeyPressFcn', @(src, evt) figure_NiftiViewer_KeyPressFcn(src, evt, guidata(src)) );
Más respuestas (0)
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!