comparison scripts/ui/questdlg.m @ 16933:e39f00a32dc7

maint: Use parentheses around condition for switch(),while(),if() statements. * libinterp/corefcn/dirfns.cc, libinterp/octave-value/ov-fcn-handle.cc, liboctave/array/Sparse.cc, scripts/image/rgb2ind.m, scripts/io/importdata.m, scripts/io/strread.m, scripts/optimization/fminbnd.m, scripts/optimization/sqp.m, scripts/plot/graphics_toolkit.m, scripts/plot/hdl2struct.m, scripts/plot/legend.m, scripts/plot/print.m, scripts/plot/printd.m, scripts/plot/private/__contour__.m, scripts/plot/private/__go_draw_axes__.m, scripts/plot/struct2hdl.m, scripts/polynomial/polyeig.m, scripts/sparse/bicg.m, scripts/specfun/ellipke.m, scripts/special-matrix/gallery.m, scripts/ui/errordlg.m, scripts/ui/helpdlg.m, scripts/ui/inputdlg.m, scripts/ui/listdlg.m, scripts/ui/questdlg.m, scripts/ui/warndlg.m: Use parentheses around condition for switch(),while(),if() statements.
author Rik <rik@octave.org>
date Tue, 09 Jul 2013 14:04:05 -0700
parents 6ae555fc8c43
children bc924baa2c4e
comparison
equal deleted inserted replaced
16932:c55df4e5e216 16933:e39f00a32dc7
118 error ("questdlg is not available in this version of Octave"); 118 error ("questdlg is not available in this version of Octave");
119 endif 119 endif
120 120
121 endfunction 121 endfunction
122 122
123
123 %!demo 124 %!demo
124 %! disp('- test questdlg with two buttons'); 125 %! disp ('- test questdlg with two buttons');
125 %! a = questdlg('Would you like some free money?',... 126 %! a = questdlg ('Would you like some free money?',...
126 %! '$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $',... 127 %! '$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $',...
127 %! 'No', 'Cancel', 'Cancel'); 128 %! 'No', 'Cancel', 'Cancel');
128 %! if strcmp (a, 'No') 129 %! if (strcmp (a, 'No'))
129 %! msgbox('Suit yourself.', 'Message Box'); 130 %! msgbox ('Suit yourself.', 'Message Box');
130 %! endif 131 %! endif
131 132
132 %!demo 133 %!demo
133 %! disp('- test questdlg with message and title only.'); 134 %! disp ('- test questdlg with message and title only.');
134 %! a = 'No'; 135 %! a = 'No';
135 %! c = 0; 136 %! c = 0;
136 %! while (strcmp(a, 'No') || !c) 137 %! while (strcmp (a, 'No') || !c)
137 %! a = questdlg('Close this Question Dialog?', 'Reductio Ad Absurdum'); 138 %! a = questdlg ('Close this Question Dialog?', 'Reductio Ad Absurdum');
138 %! if strcmp(a, 'Yes') 139 %! if (strcmp (a, 'Yes'))
139 %! q = 'Are you sure?'; 140 %! q = 'Are you sure?';
140 %! while (strcmp(a, 'Yes') && !c) 141 %! while (strcmp (a, 'Yes') && !c)
141 %! a = questdlg(q, 'Reductio Ad Absurdum'); 142 %! a = questdlg (q, 'Reductio Ad Absurdum');
142 %! word = ' really'; 143 %! word = ' really';
143 %! i = strfind(q, word); 144 %! i = strfind (q, word);
144 %! if isempty( i ) 145 %! if (isempty (i))
145 %! i = strfind(q, ' sure'); 146 %! i = strfind (q, ' sure');
146 %! q = [q '!']; 147 %! q = [q '!'];
147 %! else 148 %! else
148 %! word = [word ',']; 149 %! word = [word ','];
149 %! endif 150 %! endif
150 %! q = [q(1:i-1) word q(i:end)]; 151 %! q = [q(1:i-1) word q(i:end)];
151 %! endwhile 152 %! endwhile
152 %! endif 153 %! endif
153 %! if strcmp(a, 'Cancel') 154 %! if (strcmp (a, 'Cancel'))
154 %! warndlg('Answer "Yes" or "No".', 'Warning Dialog'); 155 %! warndlg ('Answer "Yes" or "No".', 'Warning Dialog');
155 %! a = 'No'; 156 %! a = 'No';
156 %! c = 1; 157 %! c = 1;
157 %! endif 158 %! endif
158 %! endwhile 159 %! endwhile
159 %! msgbox('Whew!'); 160 %! msgbox ('Whew!');
160 161
161 %!demo 162 %!demo
162 %! disp('- test questdlg with five inputs'); 163 %! disp ('- test questdlg with five inputs');
163 %! ans = questdlg('Are you ready Steve?', 'Brian', 'No', 'Uh huh', 'Uh huh'); 164 %! ans = questdlg ('Are you ready Steve?', 'Brian', 'No', 'Uh huh', 'Uh huh');
164 %! if !strcmp (ans, 'No') 165 %! if (! strcmp (ans, 'No'))
165 %! ans = questdlg ('Andy?', 'Brian', 'No', 'Yeah', 'Yeah'); 166 %! ans = questdlg ('Andy?', 'Brian', 'No', 'Yeah', 'Yeah');
166 %! if !strcmp (ans, 'No') 167 %! if (! strcmp (ans, 'No'))
167 %! ans = questdlg ('Mick?', 'Brian', 'No', 'Okay', 'Okay'); 168 %! ans = questdlg ('Mick?', 'Brian', 'No', 'Okay', 'Okay');
168 %! if !strcmp (ans, 'No') 169 %! if (! strcmp (ans, 'No'))
169 %! ans = msgbox ("Well all right, fellas. \n\n Let''s GO!!!!!",... 170 %! ans = msgbox ("Well all right, fellas. \n\n Let''s GO!!!!!",...
170 %! 'Ballroom Blitz', 'none'); 171 %! 'Ballroom Blitz', 'none');
171 %! endif 172 %! endif
172 %! endif 173 %! endif
173 %! endif 174 %! endif
174 175