Code covered by the BSD License  

Highlights from
quickgui

quickgui

by

 

brings up a tiny gui. use it e.g. to stop a loop inside a function by pressing a button.

quickgui(varargin)
function varargout = quickgui(varargin)

% use like this:
% 1. get handle for gui: mygui = guihandles(openfig('quickgui.fig','new'));
% 2. name the togglebutton you want to use: set(mygui.togglebutton1,'String','Stop SMC');
% 3. test if button is pressed: get(mygui.togglebutton1,'Value')==1

% QUICKGUI M-file for quickgui.fig
%      QUICKGUI, by itself, creates a new QUICKGUI or raises the existing
%      singleton*.
%
%      H = QUICKGUI returns the handle to a new QUICKGUI or the handle to
%      the existing singleton*.
%
%      QUICKGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in QUICKGUI.M with the given input arguments.
%
%      QUICKGUI('Property','Value',...) creates a new QUICKGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before quickgui_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to quickgui_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help quickgui

% Last Modified by GUIDE v2.5 20-Apr-2011 15:26:03

% Begin initialization code - DO NOT EDIT
gui_Singleton = 0;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @quickgui_OpeningFcn, ...
                   'gui_OutputFcn',  @quickgui_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before quickgui is made visible.
function quickgui_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to quickgui (see VARARGIN)

% Choose default command line output for quickgui
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);

% UIWAIT makes quickgui wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = quickgui_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over togglebutton1.
function togglebutton1_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to togglebutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(hObject,'Value',1);
set(gcbf,'WindowButtonUpFcn',{@btnUp,hObject});


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over togglebutton1.
function togglebutton2_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to togglebutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(hObject,'Value',1);
set(gcbf,'WindowButtonUpFcn',{@btnUp,hObject});


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over togglebutton1.
function togglebutton3_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to togglebutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(hObject,'Value',1);
set(gcbf,'WindowButtonUpFcn',{@btnUp,hObject});


function btnUp(fig_h,event_data,hObject)
set(hObject,'value',0)
set(fig_h,'WindowButtonUpFcn','');

Contact us