Path: news.mathworks.com!not-for-mail
From: "Amol " <amol.borkar@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Talking to multiple GUI
Date: Fri, 8 Feb 2008 21:47:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 44
Message-ID: <foiikm$153$1@fred.mathworks.com>
References: <foglbe$o9o$1@fred.mathworks.com> <fognl6$nc1$1@fred.mathworks.com>
Reply-To: "Amol " <amol.borkar@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1202507222 1187 172.30.248.37 (8 Feb 2008 21:47:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 8 Feb 2008 21:47:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 926869
Xref: news.mathworks.com comp.soft-sys.matlab:450255


It works! Thanks. Althought we don't need the global
variable in EditBox_Callback. It works without it too.


"Ashwini Deshpande" <vd.ashwini@mathworks.com> wrote in
message <fognl6$nc1$1@fred.mathworks.com>...
> "Amol " <amol.borkar@gmail.com> wrote in message
> <foglbe$o9o$1@fred.mathworks.com>...
> > I am having a lot of trouble in trying to talk to multiple
> > GUIs. I have created fig1 and fig2 which have seperate fig
> > and m files. Fig1 has a Text Box and fig2 has a Button. What
> > I would like to do is control something in fig1 by doing
> > something in fig2 e.g. change the text in TextBox of fig1 by
> > pressing the button in fig2. Can someone please tell me how
> > I should go by it? I start in fig2 and then
> > 
> > h = fig1;
> > 
> > I see fig1 but I cannot control anything beyond that... Any
> > suggestions?
> Hi Amol,
> 
> You have to define the uicontrol handle as global so that
> you can control it from outside the file. 
> 
> for example:
> Fig1 m-file:
> function EditBox_CreateFcn(hObject, eventdata, handles)
> global hObject_EditBox
> hObject_EditBox = hObject;
> 
> function EditBox_Callback(hObject, eventdata, handles)
> global EditBox
>   
> Fig2 m-file:
> function Button_Callback(hObject, eventdata, handles)
> global hObject_EditBox
> set(hObject_EditBox, 'String', 'SUCCESS');
> 
> i hope this will work, if not plz let me know.
> 
> Ashwini
>