|
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
|