Mercurial > hg > octave-nkf
changeset 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 | 6d2127468d96 |
children | 478efc95cb7a |
files | scripts/plot/uipushtool.m scripts/plot/uitoggletool.m |
diffstat | 2 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/uipushtool.m +++ b/scripts/plot/uipushtool.m @@ -27,7 +27,12 @@ [h, args] = __uiobject_split_args__ ("uipushtool", 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_uipushtool__ (h, args{:});
--- 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{:});