comparison 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
comparison
equal deleted inserted replaced
13725:6d2127468d96 13726:5a2734f26dbc
25 25
26 function handle = uitoggletool (varargin) 26 function handle = uitoggletool (varargin)
27 27
28 [h, args] = __uiobject_split_args__ ("uitoggletool", varargin, {"uitoolbar"}, 0); 28 [h, args] = __uiobject_split_args__ ("uitoggletool", varargin, {"uitoolbar"}, 0);
29 if (isempty (h)) 29 if (isempty (h))
30 h = uitoolbar (); 30 h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
31 if (isempty (h))
32 h = uitoolbar ();
33 else
34 h = h(1);
35 endif
31 endif 36 endif
32 handle = __go_uitoggletool__ (h, args{:}); 37 handle = __go_uitoggletool__ (h, args{:});
33 38
34 endfunction 39 endfunction