Simple Problem - Message Box Function
Ältere Kommentare anzeigen
I have no experience with GUI programing in Matlab. I've written a very simple callback function to display some text when a message box is closed. The text never shows, so I think the callback function is not being called. Can you please take a look and tell me what I'm doing wrong?
Cheers, Josh
function messageBox
h1=msgbox('Message Display','','none','non-modal');
set(h1,'CloseRequestFcn',@closeMsg);
function closeMsg(src,eventdata)
disp('working')
end
waitfor(h1)
end
Akzeptierte Antwort
Weitere Antworten (2)
Sean de Wolski
am 4 Mai 2011
0 Stimmen
You're modifying the closerequestfcn not the callback function for when it's pushed. If you click on the x like you're trying to exit the message box and then click on the okay button it will display 'working'.
3 Kommentare
Matt Fig
am 4 Mai 2011
But that is not the problem, see the end of my post for explanation...
Sean de Wolski
am 4 Mai 2011
But not if you click the X in the corner! If you click the X in the corner it does call the closerequestfcn and once the waitfor() is taken care of by deleting (by clicking the okay button) it will execute the closerequestfcn.
Matt Fig
am 4 Mai 2011
True enough, see my comment above on my answer. BTW, I was commenting (on your answer) on your previously posted code, not on your newer explanation, which is perfectly fine.
Josh
am 5 Mai 2011
0 Stimmen
Kategorien
Mehr zu Entering Commands finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!