Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!news2!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe04.iad.POSTED!7564ea0f!not-for-mail
From: Doug Schwarz <see@sig.for.address.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Putting a progress bar on a GUI - sorry, you're out of luck
References: <a6b98772-2bb0-4a16-932a-918c1d1cf1c8@k19g2000yqg.googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
User-Agent: MT-NewsWatcher/3.5.2 (Intel Mac OS X)
Message-ID: <see-3BB475.11194611122008@news.frontiernet.net>
Lines: 52
X-Complaints-To: abuse-news@frontiernet.net
NNTP-Posting-Date: Thu, 11 Dec 2008 16:19:49 UTC
Organization: Frontier
Date: Thu, 11 Dec 2008 11:19:47 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:506368


In article 
<a6b98772-2bb0-4a16-932a-918c1d1cf1c8@k19g2000yqg.googlegroups.com>,
 ImageAnalyst <imageanalyst@mailinator.com> wrote:

> How can I put a progress bar onto my own custom  GUI?

Come on, you could have written it in barely more time than it took you 
to rant.  Okay, sometimes it's feels good to rant.  :-)

Anyway, I wrote this for you.  Merry Christmas or <insert preferred 
holiday here>!


function h = uiwaitbar(varargin)
%uiwaitbar: A waitbar that can be embedded in a GUI figure.
%  Syntax:
%    POSITION = [20 20 200 20];  % Position of uiwaitbar in pixels.
%    H = uiwaitbar(POSITION);
%    for i = 1:100
%        uiwaitbar(H,i/100)
%    end
 
% written by Doug Schwarz, 11 December 2008
 
if ishandle(varargin{1})
    ax = varargin{1};
    value = varargin{2};
    p = get(ax,'Child');
    x = get(p,'XData');
    x(3:4) = value;
    set(p,'XData',x)
    return
end
 
pos = varargin{1};
bg_color = 'w';
fg_color = 'r';
h = axes('Units','pixels',...
    'Position',pos,...
    'XLim',[0 1],'YLim',[0 1],...
    'XTick',[],'YTick',[],...
    'Color',bg_color,...
    'XColor',bg_color,'YColor',bg_color);
patch([0 0 0 0],[0 1 1 0],fg_color,...
    'Parent',h,...
    'EdgeColor','none',...
    'EraseMode','none');

-- 
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.