Setting the figure "Tag" property for a waitbar

16 vues (au cours des 30 derniers jours)
owr
owr le 20 Fév 2013
Hi folks,
Hoping one of you has an easy solution for me. Skipping over the non-relevant details, Im trying to add a tag to a waitbar so that multiple functions can re-use the same waitbar figure. Normally I would just capture and share the handle directly, but each function is deployed as a method in a .NET dll and I have no control over how the end user will use these from C#
Specifically, why cant I used the 'Tag' property and "findobj" like I can with normal figure windows?
>> waitbar(0.2,'Message','Tag','MyWB')
>> h = findobj('Tag','MyWB')
h =
Empty matrix: 0-by-1
Im trying to mimic the 'replace' option that I can use with "warndlg"
If this turns out ot be impossible/too difficult, I have another plan that will use the waitbar handle directly and getmcruserdata/setmcruserdata.
Thanks!

Réponse acceptée

Jan
Jan le 20 Fév 2013
Modifié(e) : Jan le 20 Fév 2013
The waitbar has a hidden handle. Therefore you need findall or allchild:
waitbar(0.2, 'Message', 'Tag', 'MyWB');
h = findall(0, 'Tag', 'MyWB')
When there are a lot of graphic objects, this can be remarkably faster, because it searches the figures only:
h = findobj(allchild(0), 'flat', 'Tag', 'MyWB')
  1 commentaire
owr
owr le 26 Fév 2013
Excellent Jan, this works perfectly. My apologies for not addressing this earlier. I got involved with other projects and had forgotten that I had posted this.
Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Dialog Boxes dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by