Path: news.mathworks.com!not-for-mail
From: "Rachel Laughs" <remove.thisrachellaughs@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: How to activate other callbacks only when a pushbutton is clicked?
Date: Fri, 6 Nov 2009 21:12:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <hd23f2$r5s$1@fred.mathworks.com>
Reply-To: "Rachel Laughs" <remove.thisrachellaughs@gmail.com>
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 1257541922 27836 172.30.248.38 (6 Nov 2009 21:12:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 6 Nov 2009 21:12:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2080932
Xref: news.mathworks.com comp.soft-sys.matlab:583122


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