|
On Nov 6, 1:12 pm, "Rachel Laughs" <remove.thisrachellau...@gmail.com>
wrote:
> I am creating my first GUI in MATLAB. I prefer to do this programmatically.
>
> I have an initial figure/panel/menu thing set up with 3 interactive components:
> 1. user is asked to enter in a filename, which will be loaded
> 2. user is asked to select an item from a pop-up menu
> 3. OK button to confirm choices and move on (aka intialize callbacks of parts 1 and 2)
>
> a) How do you associate the callbacks of the first two parts to the third, so that only when the "OK" button is pushed does the other callbacks occur?
>
> I tried to do this as 2 functions embedded in the push-button function, but I get the error "undefined function or method...for input arguments" which I am assuming is because this type of subfunction isn't allowed.
>
> b) How do I take the entered string value from the edit uicontrol box (component 1) and have the callback function load this as a file?
>
> When I start messing with callbacks, I have really no clue what is going on. I might also be grossly misunderstanding the entire concept of them! I have read the supplied docs, and thought I understood, but really failed when trying to write my code.
>
> c) Also: in an application example in the GUI docs ("simple_gui_2"), there is a portion that says:
>
> function popup_menu_Callback(source,eventdata)
> % Determine the selected data set.
> str = get(source, 'String');
> val = get(source,'Value');
> % Set current data to the selected data set.
> switch str{val};
>
> now, what is this "(source,eventdata)" business going on in the code? "source" and "eventdata" don't appear to be defined/used anywhere else. I tried searching in the Help and it did not make sense to me. Any more-plain-English explanations would be greatly appreciated!
>
> I apologize if a similar thread has already been resolved and I just didn't come across it. Please feel free to link me to any other relevant threads. Thank you very much!!
I can't be of much help here other than pointing you to a set of
programmable gui examples submitted by Matt Fig:
http://www.mathworks.com/matlabcentral/fileexchange/24861-35-complete-gui-examples
Good luck. I'm sure there is plenty you will learn from those.
-Nathan
|