No BSD License  

Highlights from
NESim

image thumbnail
from NESim by Chris Eliasmith
General package for large-scale biologically plausible simulations (with GUI).

gui_textEntryDialog(varargin)
function [okCancel, textValue] = gui_textEntryDialog(varargin)
% GUI_TEXTENTRYDIALOG Application M-file for gui_textEntryDialog.fig
%    FIG = GUI_TEXTENTRYDIALOG launch gui_textEntryDialog GUI.
%    GUI_TEXTENTRYDIALOG('callback_name', ...) invoke the named callback.

% Last Modified by GUIDE v2.5 07-Jan-2002 21:37:46
%
% Modified on 10/29/01 by John Harwell
%
%  Removed a couple of debugging print statements.

global SimName lastSavedName

if nargin == 0
	fig = openfig(mfilename,'reuse');
	
    
	% Generate a structure of handles to pass to callbacks, and store it. 
	handles = guihandles(fig);
    
    if(length(lastSavedName)==0)
        set(handles.textEntryText,'String',[SimName '_settings']);
    else
        set(handles.textEntryText,'String',lastSavedName);
    end
   
	guidata(fig, handles);
	set(fig, 'Name', 'Save Settings...');
    
	uiwait(fig);
	
	if ~ishandle(fig);
        okCancel = 'cancel';
		% Wait for callbacks to run and window to be dismissed:
        textValue = '';
    else
        handles = guidata(fig);
        okCancel = handles.okCancel;
        textValue =  get(handles.textEntryText,'String');
        lastSavedName = textValue;
        delete(fig);
	end
    
elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK

  try
    [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
  catch
    disp(lasterr);
  end 
end

%| ABOUT CALLBACKS:
%| GUIDE automatically appends subfunction prototypes to this file, and 
%| sets objects' callback properties to call them through the FEVAL 
%| switchyard above. This comment describes that mechanism.
%|
%| Each callback subfunction declaration has the following form:
%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)
%|
%| The subfunction name is composed using the object's Tag and the 
%| callback type separated by '_', e.g. 'slider2_Callback',
%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
%|
%| H is the callback object's handle (obtained using GCBO).
%|
%| EVENTDATA is empty, but reserved for future use.
%|
%| HANDLES is a structure containing handles of components in GUI using
%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
%| structure is created at GUI startup using GUIHANDLES and stored in
%| the figure's application data using GUIDATA. A copy of the structure
%| is passed to each callback.  You can store additional information in
%| this structure at GUI startup, and you can change the structure
%| during callbacks.  Call guidata(h, handles) after changing your
%| copy to replace the stored original so that subsequent callbacks see
%| the updates. Type "help guihandles" and "help guidata" for more
%| information.
%|
%| VARARGIN contains any extra arguments you have passed to the
%| callback. Specify the extra arguments by editing the callback
%| property in the inspector. By default, GUIDE sets the property to:
%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))
%| Add any extra arguments after the last argument, before the final
%| closing parenthesis.



% --------------------------------------------------------------------
function varargout = textEntryText_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.textEntryText.

handles.textValue = get(h, 'String');
guidata(h, handles);


% --------------------------------------------------------------------
function varargout = okButton_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.okButton.
handles.okCancel = 'ok';
guidata(h, handles);
uiresume(handles.figure1);
% --------------------------------------------------------------------
function varargout = cancelButton_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.cancelButton.
handles.okCancel = 'cancel';
guidata(h, handles);
uiresume(handles.figure1);

Contact us at files@mathworks.com