Setting the figure "Tag" property for a waitbar

16 次查看(过去 30 天)
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!

采纳的回答

Jan
Jan 2013-2-20
编辑:Jan 2013-2-20
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 个评论
owr
owr 2013-2-26
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!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dialog Boxes 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by