How can I determine if a help dialog box is open, and then close it if it is open
Ältere Kommentare anzeigen
This dialog box is opened by a function in a class object. If a class object function hangs up, the dialog box is left open. The dialog box is created by the following obj.info = op_status(obj.info,'Running');
op_status function is: function rc = op_status(fh,str) fh =helpdlg(str, 'Tester Status'); set(fh,'Position',[10 260 160 60],'MenuBar','none'); rc = fh; end
I can close the dialog box by issuing the simple command close(obj.info).
But, if the box is already closed, I get this error message:
??? Error using ==> close at 93
Invalid figure handle.
I want to include this within a script or function to reset figures and listeners, etc. when something hangs up.
I tried findobj to detect the help dialog box, but it does not seem to detect it.
Akzeptierte Antwort
Weitere Antworten (2)
Matt Fig
am 18 Mär. 2011
For future reference, FINDOBJ won't return the handle to objects which have handlevisibility set to off. Use FINDALL instead. In particular,
helpdlg('Help string','Help Dialog')
findall(0,'tag','Msgbox_Help Dialog') % Notice how Tag was made.
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects 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!