Setting the figure "Tag" property for a waitbar

11 Ansichten (letzte 30 Tage)
owr
owr am 20 Feb. 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!

Akzeptierte Antwort

Jan
Jan am 20 Feb. 2013
Bearbeitet: Jan am 20 Feb. 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 Kommentar
owr
owr am 26 Feb. 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!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Dialog Boxes finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by