Setting the figure "Tag" property for a waitbar

조회 수: 16 (최근 30일)
owr
owr 2013년 2월 20일
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