Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Gui Pushbutton default
Date: Tue, 21 Jul 2009 13:09:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 69
Message-ID: <h44ele$30a$1@fred.mathworks.com>
References: <h42ns9$kun$1@fred.mathworks.com> <14ea2dbd-e56d-4b48-8fdc-39b0060a5ee4@p36g2000prn.googlegroups.com> <h43und$mqu$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1248181742 3082 172.30.248.38 (21 Jul 2009 13:09:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 21 Jul 2009 13:09:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1895050
Xref: news.mathworks.com comp.soft-sys.matlab:557111


"ching l" <chinglnc@hotmail.com> wrote in message <h43und$mqu$1@fred.mathworks.com>...
> Nathan <ngreco32@gmail.com> wrote in message <14ea2dbd-e56d-4b48-8fdc-39b0060a5ee4@p36g2000prn.googlegroups.com>...
> > On Jul 20, 2:34?pm, "ching l" <ching...@hotmail.com> wrote:
> > > Hello there,
> > >
> > > How do I set the pushbutton off by default?
> > > This is what I've tried but apparently that isn't right.
> > >
> > > -----------------------------------------------------------
> > > function next_Callback(hObject, eventdata, handles)
> > >
> > > handles = guidata(gcbo);
> > >
> > > set(hObject, 'enable', 'off')
> > >
> > > guidata(gcbo, handles);
> > >
> > > ------------------------------------------------------------
> > >
> > > Please advise.
> > >
> > > Thanks.
> > 
> > What do you mean by "off"? Do you mean disabled, or do you mean
> > invisible?
> > In either case...
> > Let's say your push button tag is pushbutton1
> > 
> > To disable it:
> > set(handles.pushbutton1,'Enable','off')
> > 
> > To make it invisible:
> > set(handles.pushbutton1,'Visible','off')
> > 
> > Either of those should work.
> > -Nathan
> 
> Hello, my push button tag is set to next. 
> 
> my codes are, 
> 
> function next_Callback(hObject, eventdata, handles)
> 
> set(handles.next,'Enable','off')
> 
> but it doesn't seem to work.
> 
> Did i miss out anything?

The following works for me (saved as test.m):

function test
    f=figure('Units','normalized',...
        'Position',[.4 .4 .2 .2],...
        'Visible','on');

    push1=uicontrol('Style','pushbutton',...
        'Parent',f,...
        'Units','characters',...
        'Position',[5 2 20 2],...
        'Callback',{@push1_Callback},...
        'String','Disable');

    function push1_Callback(src,eventdata)
        set(push1,'Enable','off');
    end
end

Can you say a little bit more about what exactly went wrong?