Mercurial > hg > octave-lyh
diff scripts/plot/uitoggletool.m @ 13726:5a2734f26dbc
Create uitoolbar only when necessary.
* plot/uipushtool.m: Look for existing toolbar before creating a new one.
* plot/uitoggletool.m: Likewise.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Wed, 19 Oct 2011 17:15:42 +0100 |
parents | 22ce748da25f |
children | 72c96de7a403 |
line wrap: on
line diff
--- a/scripts/plot/uitoggletool.m +++ b/scripts/plot/uitoggletool.m @@ -27,7 +27,12 @@ [h, args] = __uiobject_split_args__ ("uitoggletool", varargin, {"uitoolbar"}, 0); if (isempty (h)) - h = uitoolbar (); + h = findobj (gcf, "-depth", 1, "type", "uitoolbar"); + if (isempty (h)) + h = uitoolbar (); + else + h = h(1); + endif endif handle = __go_uitoggletool__ (h, args{:});