GUI does not recognize existing handles after using addlistener
Afficher commentaires plus anciens
0 down vote favorite
I am quite new to MATLAB GUI programming (using GUIDE sorry) and I have an annoying issue: The GUI displays on an axis an image sequence stored in a cell array. I have a couple of pushbuttons and a slider to scroll through the sequence. In order to get a 'continuous slider' I use a listener object, which kind of works but creates some problems:
1) When I press the slider, a figure is created outside the GUI and the first frame of the sequence is displayed in it, but as I move the slider the sequence is displayed in the axis of my GUI (which is what I want) and the figure becomes empty. Can anybody tell me why this figure is created and how can I avoid it appearing?
2) Once I press the slider button and thus use the listener, all handles inside the GUI are not functionnal as Matlab does not recognize them and I'm stuck with a functionnal slider/display but I can't use the pushbuttons. In other words, it's like only the axis and the slider were in the GUI and every other elements (pushbuttons, text boxes, etc.) were non existent.
Any ideas on why this happens? Here is the code I use in the Create Function of the slider:
function slider_Frame_Video_Callback(hObject, eventdata, handles)
hListener = addlistener(hObject,'ContinuousValueChange',@(a,b) slider2_Frame_Video_Callback(hObject, eventdata, handles)); % a and b are dummy arguments
guidata(hObject,handles)
In the slider callback, the code looks like this (basically imshow in the current axis):
axes(hAxis)
imshow(Movie{frame},'parent',hAxis);
drawnow
% This does not work either as handles.edit_FrameNumber is not recognized by Matlab
set(handles.edit_FrameNumber, 'String', frame);
guidata(hObject,handles);
Thanks a lot for any hints/input!
2 commentaires
Sean de Wolski
le 2 Juin 2014
Can you attach it? What is _frame?
Ben11
le 2 Juin 2014
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Interactive Control and Callbacks dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!