How can I determine if a help dialog box is open, and then close it if it is open

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.

 Respuesta aceptada

try
close(obj.info)
catch
end

1 comentario

Elaine you accepted my answer but the other answers are better, please select other answer or I will delete this one, thanks

Iniciar sesión para comentar.

Más respuestas (2)

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.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 18 de Mzo. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by