Mercurial > hg > aimmat
comparison aim-mat/gui/sr_questionbox.m @ 4:537f939baef0 tip
various bug fixes and changed copyright message
author | Stefan Bleeck <bleeck@gmail.com> |
---|---|
date | Tue, 16 Aug 2011 14:37:17 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:20ada0af3d7d | 4:537f939baef0 |
---|---|
1 % | |
2 % (c) 2011, University of Southampton | |
3 % Maintained by Stefan Bleeck (bleeck@gmail.com) | |
4 % download of current version is on the soundsoftware site: | |
5 % http://code.soundsoftware.ac.uk/projects/aimmat | |
6 % documentation and everything is on http://www.acousticscale.org | |
7 | |
8 function varargout = sr_questionbox(varargin) | |
9 % SR_QUESTIONBOX M-file for sr_questionbox.fig | |
10 % SR_QUESTIONBOX, by itself, creates a new SR_QUESTIONBOX or raises the existing | |
11 % singleton*. | |
12 % | |
13 % H = SR_QUESTIONBOX returns the handle to a new SR_QUESTIONBOX or the handle to | |
14 % the existing singleton*. | |
15 % | |
16 % SR_QUESTIONBOX('CALLBACK',hObject,eventData,handles,...) calls the local | |
17 % function named CALLBACK in SR_QUESTIONBOX.M with the given input arguments. | |
18 % | |
19 % SR_QUESTIONBOX('Property','Value',...) creates a new SR_QUESTIONBOX or raises the | |
20 % existing singleton*. Starting from the left, property value pairs are | |
21 % applied to the GUI before sr_questionbox_OpeningFunction gets called. An | |
22 % unrecognized property name or invalid value makes property application | |
23 % stop. All inputs are passed to sr_questionbox_OpeningFcn via varargin. | |
24 % | |
25 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one | |
26 % instance to run (singleton)". | |
27 % | |
28 % See also: GUIDE, GUIDATA, GUIHANDLES | |
29 | |
30 % Edit the above text to modify the response to help sr_questionbox | |
31 | |
32 % Last Modified by GUIDE v2.5 14-Mar-2003 17:30:37 | |
33 | |
34 % Begin initialization code - DO NOT EDIT | |
35 gui_Singleton = 1; | |
36 gui_State = struct('gui_Name', mfilename, ... | |
37 'gui_Singleton', gui_Singleton, ... | |
38 'gui_OpeningFcn', @sr_questionbox_OpeningFcn, ... | |
39 'gui_OutputFcn', @sr_questionbox_OutputFcn, ... | |
40 'gui_LayoutFcn', [] , ... | |
41 'gui_Callback', []); | |
42 if nargin & isstr(varargin{1}) | |
43 gui_State.gui_Callback = str2func(varargin{1}); | |
44 end | |
45 | |
46 if nargout | |
47 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); | |
48 else | |
49 gui_mainfcn(gui_State, varargin{:}); | |
50 end | |
51 % End initialization code - DO NOT EDIT | |
52 | |
53 | |
54 % --- Executes just before sr_questionbox is made visible. | |
55 function sr_questionbox_OpeningFcn(hObject, eventdata, handles, varargin) | |
56 % This function has no output args, see OutputFcn. | |
57 % hObject handle to figure | |
58 % eventdata reserved - to be defined in a future version of MATLAB | |
59 % handles structure with handles and user data (see GUIDATA) | |
60 % varargin command line arguments to sr_questionbox (see VARARGIN) | |
61 | |
62 % Choose default command line output for sr_questionbox | |
63 handles.output = hObject; | |
64 | |
65 old_sr=varargin{1}; | |
66 handles.old_sr=old_sr; | |
67 handles.output=old_sr; | |
68 | |
69 set(handles.edit1,'String',old_sr); | |
70 | |
71 | |
72 % Update handles structure | |
73 guidata(hObject, handles); | |
74 | |
75 % do modal | |
76 % UIWAIT makes sr_questionbox wait for user response (see UIRESUME) | |
77 uiwait(handles.figure1); | |
78 | |
79 | |
80 % --- Outputs from this function are returned to the command line. | |
81 function varargout = sr_questionbox_OutputFcn(hObject, eventdata, handles) | |
82 % varargout cell array for returning output args (see VARARGOUT); | |
83 % hObject handle to figure | |
84 % eventdata reserved - to be defined in a future version of MATLAB | |
85 % handles structure with handles and user data (see GUIDATA) | |
86 | |
87 % Get default command line output from handles structure | |
88 varargout{1} = handles.output; | |
89 close(handles.figure1); | |
90 | |
91 | |
92 % --- Executes during object creation, after setting all properties. | |
93 function edit1_CreateFcn(hObject, eventdata, handles) | |
94 % hObject handle to edit1 (see GCBO) | |
95 % eventdata reserved - to be defined in a future version of MATLAB | |
96 % handles empty - handles not created until after all CreateFcns called | |
97 | |
98 % Hint: edit controls usually have a white background on Windows. | |
99 % See ISPC and COMPUTER. | |
100 if ispc | |
101 set(hObject,'BackgroundColor','white'); | |
102 else | |
103 set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); | |
104 end | |
105 | |
106 | |
107 | |
108 function edit1_Callback(hObject, eventdata, handles) | |
109 % hObject handle to edit1 (see GCBO) | |
110 % eventdata reserved - to be defined in a future version of MATLAB | |
111 % handles structure with handles and user data (see GUIDATA) | |
112 | |
113 % Hints: get(hObject,'String') returns contents of edit1 as text | |
114 % str2double(get(hObject,'String')) returns contents of edit1 as a double | |
115 | |
116 num=str2num(get(handles.edit1,'String')); | |
117 if isempty(num) | |
118 num=handles.old_sr; | |
119 end | |
120 if num<1 | |
121 num=handles.old_sr; | |
122 end | |
123 set(handles.edit1,'String',num2str(num)); | |
124 | |
125 handles.output=num; | |
126 guidata(hObject, handles); | |
127 | |
128 % --- Executes on button press in pushbutton1. | |
129 function pushbutton1_Callback(hObject, eventdata, handles) | |
130 % hObject handle to pushbutton1 (see GCBO) | |
131 % eventdata reserved - to be defined in a future version of MATLAB | |
132 % handles structure with handles and user data (see GUIDATA) | |
133 handles.output=str2num(get(handles.edit1,'String')); | |
134 guidata(hObject, handles); | |
135 uiresume; | |
136 | |
137 % --- Executes on button press in pushbutton2. | |
138 function pushbutton2_Callback(hObject, eventdata, handles) | |
139 % hObject handle to pushbutton2 (see GCBO) | |
140 % eventdata reserved - to be defined in a future version of MATLAB | |
141 % handles structure with handles and user data (see GUIDATA) | |
142 handles.output=handles.old_sr; | |
143 guidata(hObject, handles); | |
144 uiresume; | |
145 |