Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab GUI newbye
Date: Mon, 1 Dec 2008 23:11:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 73
Message-ID: <gh1qu5$sg6$1@fred.mathworks.com>
References: <ggv8nh$smj$1@fred.mathworks.com> <c2fd2c68-5120-49ca-8cd0-06ca543eb7be@20g2000yqt.googlegroups.com> <3bec2bf3-471a-4709-a44c-b9be2364ac0d@k19g2000yqg.googlegroups.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 1228173061 29190 172.30.248.38 (1 Dec 2008 23:11:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 1 Dec 2008 23:11:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1505224
Xref: news.mathworks.com comp.soft-sys.matlab:504246


ImageAnalyst <imageanalyst@mailinator.com> wrote in message <3bec2bf3-471a-4709-a44c-b9be2364ac0d@k19g2000yqg.googlegroups.com>...
> On Dec 1, 10:17=A0am, ImageAnalyst <imageanal...@mailinator.com> wrote:
> > On Dec 1, 8:55=A0am, "Husam Aldahiyat" <numand...@gmail.com> wrote:
> >
> > > GUIDE on default creates an m-file for your GUI with callback functions=
>  for each of the uicontrols that you put (edit, text, slider, etc.). So aft=
> er you make the GUI and save it, scroll down to one of the functions and pu=
> t your code there (you can check control's callback but doiuble clicking on=
>  it).
> >
> > -------------------------------------------------------------------------=
> --=AD--------------
> > Well, not exactly. =A0These functions are only created in your source
> > code AFTER you right click on the control then select "View Callbacks"
> > and pick the callback function that you want. =A0Only AFTER this, does
> > the callback function actually show up in the source code. =A0(Try it
> > and you'll see.)
> >
> > Your best option may be to create the callbacks by right clicking as
> > described above, then paste your template code (from some other m-
> > file) into the appropriate function. =A0I just go with the automatically-
> > created callback function names, but you can change these if you want
> > by modifying the string in the callback property of the control. =A0This
> > will give it the name you want instead of the automatically-generated
> > name. =A0So this could be an option for you if you really like the
> > function names in your template instead. =A0Just make sure that the
> > three input arguments match the automatically-generated input
> > arguments.
> >
> > I know it's not as nice as Visual Studio and I hear they are working
> > on a massive upgrade for the lame GUIDE. =A0For example, when you double
> > click the control, it brings up the properties window instead of the
> > callback source code (Visual Studio brings up the callback source
> > code). =A0Plus there's no way to dock the properties window. =A0Why they
> > chose not to allow docking of that window when they do allow docking
> > of most other windows, I don't know. =A0I'd prefer a docked properties
> > window and to go to the control's callback source code when you double
> > click on the control (i.e. just like it is in Visual Studio). =A0And
> > control-a selects all controls on the figure EXCEPT those controls
> > within group boxes. =A0And there's the whole issue with units -
> > normalized, pixels, etc. =A0How if you're in normalized and then want to
> > adjust something - well, it's a major pain to get things aligned. =A0I
> > could go on but they know it's crappy and hopefully the next version
> > will be a lot better. =A0But for now, it's all we have and it's still
> > better than creating all the figures and controls on it manually in
> > your code.
> > Regards,
> > ImageAnalyst
> 
> -------------------------------------------------------
> Frank:
> Oh yeah, one other thing I forgot to tell you.  When you view the
> callback, it creates two functions: the callback and an "CreateFcn"
> function.  You put your code into the callback.  But even though the
> CreateFcn() function for that control doesn't have any code in it,
> don't think that it's safe to delete it.  You might think so because
> there may be other controls on the figure that you haven't viewed the
> callback for (checkboxes, etc.) and they don't have Create functions
> for them but yet they do, in fact, get created.  So you might think
> that they are optional, especially since there's no code inside it,
> only comments.  However if you delete the CreateFcn() and run your
> code, all hell breaks loose.  MATLAB crashes with a big dump.  So
> don't delete any CreateFcn() functions once they are created.  It may
> even totally corrupt your file and the only option is to get an old
> copy from a backup that you've hopefully made (I know from experience
> - several times!).  I just now (this morning) verfied this crash
> again, in R2008b, so it's still not fixed.  You've been warned.
> Good luck,
> ImageAnalyst

I thank you very much! Your answer was very satisfying. I will ask you in future if I need some hint about GUI. Now I start my struggle with GUIDE!

Frank