3 //3 spinner and sliders
11 //11 opticlim uicontrol
21 f1.position(3:4) = [250, 100];
23 uicontrol(f1, "position", [25 25 50 50], "string", "+1", "callback", "v = eval(get(''num'', ''string''));set(''num'', ''string'', string(v + 1));");
24 uicontrol(f1, "position", [100 25 50 50], "string", "0", "tag", "num", "callback", "set(''num'', ''string'', ''0'');");
25 uicontrol(f1, "position", [175 25 50 50], "string", "-1", "callback", "v = eval(get(''num'', ''string''));set(''num'', ''string'', string(v - 1));");
32 f2.position(3:4) = [50 * dim + 50, 50 * dim + 125];
34 x = floor((i-1) / dim);
35 y = modulo((i-1), dim);
36 uicontrol(f2, "position", [25 + 50*x, 100 + 50*y,50,50],"string", string(x) + " - " + string(y), "callback", "set(gcbo, ''enable'', %f)");
39 uicontrol(f2, "position", [f2.position(3)/2 - 50, 25, 100, 50], "string", "reset", "callback", "c = gcbo.parent.children;for i=1:size(c, ''*''), c(i).enable = %t;end");
48 minval = get("min", "value");
49 maxval = get("max", "value");
50 set("slider", "value", string(((maxval - minval) / 2) + minval));
54 set("slider", "min", get("min", "value"));
55 step = get("step", "value");
56 set("slider", "sliderstep", [step, step*10]);
57 set("slider", "max", get("max", "value"));
62 f.position(3:4) = [300, 200];
64 uicontrol("style", "text", "string", "0", "position", [120, 160, 60, 20], "horizontalalignment", "center", "tag", "val");
65 uicontrol("style", "slider", "position", [10 120 280 30], "min", -100, "max", 100, "sliderstep", [1, 1], "value", 0, "tag", "slider");
67 uicontrol("style", "text", "string", "min", "position", [25 80 50 20], "horizontalalignment", "center");
68 uicontrol("style", "text", "string", "step", "position", [125 80 50 20], "horizontalalignment", "center");
69 uicontrol("style", "text", "string", "max", "position", [225 80 50 20], "horizontalalignment", "center");
71 uicontrol("style", "spinner", "min", -100, "max", 0, "sliderstep", [1, 1], "value", "-100", "position", [25 50 50 20], "horizontalalignment", "center", "tag", "min");
72 uicontrol("style", "spinner", "min", 1, "max", 10, "sliderstep", [1, 1], "value", "1", "position", [125 50 50 20], "horizontalalignment", "center", "tag", "step");
73 uicontrol("style", "spinner", "min", 0, "max", 100, "sliderstep", [1, 1], "value", "100", "position", [225 50 50 20], "horizontalalignment", "center", "tag", "max");
75 uicontrol("style", "pushbutton", "string", "reset", "position", [100 10 100 30], "callback", "reset");
78 set("slider", "callback", "val = gcbo.value;set(""val"", ""string"", string(val));");
79 set("min", "callback", "onchange");
80 set("step", "callback", "onchange");
81 set("max", "callback", "onchange");
88 f.position = [200 200 240 470];
91 fr1 = uicontrol("style", "frame", "position", [10 10 220 450], "border", createBorder("etched"));
92 spinner = uicontrol(fr1, "style", "spinner", "string", "0", "position", [10 410 200 30], "horizontalalignment", "right", "min", 0, "max", 5);
93 label = uicontrol(fr1, "style", "text", "string", "usedeprecatedskin=""off""", "position", [10 370 200 30], "backgroundcolor", [1 0 1]);
94 editbox = uicontrol(fr1, "style", "edit", "string", "Edit", "position", [10 330 200 30], "backgroundcolor", [1 0 0]);
95 button = uicontrol(fr1, "style", "pushbutton", "string", "Pushbutton", "position", [10 290 200 30]);
96 checkbox = uicontrol(fr1, "style", "checkbox", "string", "Checkbox", "position", [10 250 200 30]);
97 radio = uicontrol(fr1, "style", "radiobutton", "string", "Radiobutton", "position", [10 210 200 30]);
98 slider = uicontrol(fr1, "style", "slider", "position", [10 150 200 50]);
99 frame = uicontrol(fr1, "style", "frame", "position", [10 110 200 30], "backgroundcolor", [0.5 0.5 0.5]);
100 listbox = uicontrol(fr1, "style", "listbox", "string", "listbox1|listbox2|listbox3|listbox4|listbox5", "position", [10 50 200 50], "backgroundcolor", [0.2 0.2 0.2]);
101 combo = uicontrol(fr1, "style", "popupmenu", "string", "popupmenu1|popupmenu2", "position", [10 10 200 30], "backgroundcolor", [0.8 0.8 0.8]);
109 R = get("sliderR", "value");
110 G = get("sliderG", "value");
111 B = get("sliderB", "value");
112 set("textR", "string", string(R));
113 set("textG", "string", string(G));
114 set("textB", "string", string(B));
115 set("color", "backgroundcolor", [R, G, B]/255);
121 f.position(3:4) = [300, 130];
123 uicontrol("style", "slider", "position", [10 10 128 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderB");
124 uicontrol("style", "slider", "position", [10 50 128 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderG");
125 uicontrol("style", "slider", "position", [10 90 128 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderR");
127 uicontrol("style", "text", "position", [150 15 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textB");
128 uicontrol("style", "text", "position", [150 55 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textG");
129 uicontrol("style", "text", "position", [150 95 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textR");
131 uicontrol("style", "frame", "position", [200 20 90 90], "tag", "color", "backgroundcolor", [0, 0, 0]);
133 set("sliderR", "callback", "onChange");
134 set("sliderG", "callback", "onChange");
135 set("sliderB", "callback", "onChange");
144 R = get("sliderR", "value");
145 G = get("sliderG", "value");
146 B = get("sliderB", "value");
147 set("textR", "string", string(R));
148 set("textG", "string", string(G));
149 set("textB", "string", string(B));
150 set("color", "backgroundcolor", [R, G, B]/255);
155 f1.position = [100, 100, 350, 130];
156 f1.figure_name = "sliders";
158 uicontrol(f1, "style", "slider", "position", [10 10 256 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderB");
159 uicontrol(f1, "style", "slider", "position", [10 50 256 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderG");
160 uicontrol(f1, "style", "slider", "position", [10 90 256 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderR");
162 uicontrol(f1, "style", "text", "position", [300 15 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textB");
163 uicontrol(f1, "style", "text", "position", [300 55 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textG");
164 uicontrol(f1, "style", "text", "position", [300 95 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textR");
167 f2.position = [450, 100, 130, 130];
168 f2.figure_name = "RGB";
169 uicontrol(f2, "style", "frame", "position", [15 15 100 100], "tag", "color", "backgroundcolor", [0, 0, 0]);
171 set("sliderR", "callback", "onChange");
172 set("sliderG", "callback", "onChange");
173 set("sliderB", "callback", "onChange");
181 f.layout_options = createLayoutOptions("border", [10, 20]);
182 //f.layout_options = createLayoutOptions("border");
184 c = createConstraints("border", "top", [50,20]);
193 u_grid1 = uicontrol(f,...
195 "backgroundcolor", [1 0 0], ...
201 u_grid2 = uicontrol(f,...
203 "backgroundcolor", [0 1 0], ...
208 c.position = "center";
209 u_grid3 = uicontrol(f,...
211 "backgroundcolor", [0 0 1], ...
216 c.preferredsize = [100, 100];
217 c.position = "right";
218 u_grid4 = uicontrol(f,...
220 "backgroundcolor", [1 1 0], ...
225 c.position = "bottom";
226 u_grid5 = uicontrol(f,...
228 "backgroundcolor", [1 0 1], ...
236 f.position = [200 200 200 100];
237 f.layout = "gridbag";
239 c = createConstraints("gridbag",[1, 1, 1, 1], [1, 1], "both", "center", [0, 0], [50, 50]);
241 redf_grid = [1, 1, 1, 1];
242 greenf_grid = [1, 2, 1, 1];
243 bluef_grid = [1, 3, 2, 1];
244 yelf_grid = [2, 1, 1, 2];
245 magf_grid = [3, 1, 1, 1];
246 cyanf_grid = [3, 2, 1, 2];
249 u_grid3 = uicontrol(f , ...
250 "style" , "frame", ...
251 "backgroundcolor" , [0 0 1], ...
255 u_grid1 = uicontrol(f , ...
256 "style" , "frame", ...
257 "backgroundcolor" , [0 1 1], ...
261 u_grid1 = uicontrol(f , ...
262 "style" , "frame" , ...
263 "backgroundcolor" , [1 0 0] , ...
266 c.grid = greenf_grid;
267 u_grid2 = uicontrol(f , ...
268 "style" , "frame", ...
269 "backgroundcolor" , [0 1 0], ...
273 u_grid4 = uicontrol(f , ...
274 "style" , "frame", ...
275 "backgroundcolor" , [1 1 0], ...
279 u_grid5 = uicontrol(f , ...
280 "style" , "frame", ...
281 "backgroundcolor" , [1 0 1], ...
292 set("push", "string", string(get("tab", "value")));
296 f.position = [200 200 400 300];
298 tab = uicontrol(f, "style", "tab", "tag", "tab", "position", [0 30 400, 270]);
300 tab3 = uicontrol(tab, "style", "frame", "string", "Blue", "layout", "border", "backgroundcolor", [0 0 1]);
301 tab2 = uicontrol(tab, "style", "frame", "string", "Green", "layout", "border", "backgroundcolor", [0 1 0]);
302 tab1 = uicontrol(tab, "style", "frame", "string", "Red", "layout", "border", "backgroundcolor", [1 0 0]);
304 uicontrol(f, "style", "pushbutton", "string", "push me", "callback", "onPush", "tag", "push", "position", [150 0 100 30]);
306 set("tab", "value", 1);
311 fig_pregui = figure("figure_name", "OPTICLIM - site and weather selection", ...
312 "dockable", "off", ...
313 "axes_size", [500,170], ...
314 "infobar_visible", "off", ...
315 "toolbar", "none", ...
316 "menubar_visible", "on", ...
317 "menubar", "none", ...
318 "default_axes", "off", ...
320 "layout", "border", ...
321 "background", color(244,244,244), ...
322 "tag", "figure_preopticlim", ...
325 //b1 = createBorder("titled", createBorder("etched"), "Choose your site:", "left", "top", createBorderFont("", 11, "bold"), "black");
327 OpticlimPath = "E:\git\toolbox\sanofi-opticlim\";
328 f = uicontrol(fig_pregui, "style", "frame", ...
330 //font1 = createBorderFont("", 11, "bold");
331 //b1 = createBorder("titled", createBorder("etched"), _d("OPTICLIM", "Choose your site")+":", "left", "top", font1, "black");
332 f1 = uicontrol(f, "style", "frame", ...
333 "layout", "gridbag", ...
334 "constraints", createConstraints("gridbag", [1 1 3 1], [1 1], "both", "left"), ...
336 uicontrol(f1, "style", "popupmenu", "string", [], ...
338 "horizontalAlignment", "center", ...
339 "margins", [0,5,0,5], ...
340 "tag", "site_list", ...
341 "callback", "cbChangeSite", ...
342 "constraints", createConstraints("gridbag", [1 1 1 1], [5 1], "horizontal", "left", [0,0], [330,22]));
343 path_icon = OpticlimPath+"pictures/list-add.png";
344 uicontrol(f1, "style", "pushbutton", "string", "", ...
346 "horizontalAlignment", "center", ...
347 "icon", path_icon, ...
348 "margins", [0,5,0,5], ...
349 "callback", "cbAddSite", ...
350 "constraints", createConstraints("gridbag", [2 1 1 1], [1 1], "horizontal", "left"));
353 fig_pregui.visible = "on";
362 set("tabs", "value", 2);
365 r1 = "r1: " + string(get("radio1", "value")) + " ";
366 r2 = "r2: " + string(get("radio2", "value")) + " ";
367 c1 = "c1: " + string(get("check1", "value")) + " ";
368 c2 = "c2: " + string(get("check2", "value")) + " ";
369 t1 = "t1: " + string(get("tabs", "value"));
373 set("label", "string", r1+r2+c1+c2+t1);
377 f.position = [200 200 240 460];
380 fr1 = uicontrol("style", "frame", "position", [10 10 220 440], "border", createBorder("etched"));
381 checkbox1 = uicontrol(fr1, "style", "checkbox", "string", "Checkbox 1", "position", [10 400 200 30], "tag", "check1");
382 checkbox2 = uicontrol(fr1, "style", "checkbox", "string", "Checkbox 2", "position", [10 370 200 30], "tag", "check2");
383 editbox = uicontrol(fr1, "style", "edit", "string", "Edit", "position", [10 330 200 30]);
384 frame = uicontrol(fr1, "style", "frame", "position", [10 270 200 50]);
385 button = uicontrol(fr1, "style", "pushbutton", "string", "Pushbutton", "position", [10 230 200 30], "callback", "onPush");
386 radio1 = uicontrol(fr1, "style", "radiobutton", "string", "Radio 1", "position", [10 190 200 30], "groupname", "radio", "tag", "radio1");
387 radio2 = uicontrol(fr1, "style", "radiobutton", "string", "Radio 2", "position", [10 160 200 30], "groupname", "radio", "tag", "radio2");
388 combo = uicontrol(fr1, "style", "popupmenu", "string", "popupmenu1|popupmenu2|popupmenu3|popupmenu4", "position", [10 120 200 30]);
390 tab = uicontrol(fr1, "style", "tab", "position", [10 50 200 60], "tag", "tabs");
391 tab3 = uicontrol(tab, "style", "frame", "string", "Blue", "backgroundcolor", [0 0 1]);
392 tab2 = uicontrol(tab, "style", "frame", "string", "Green", "backgroundcolor", [0 1 0]);
393 tab1 = uicontrol(tab, "style", "frame", "string", "Red", "backgroundcolor", [1 0 0]);
395 label = uicontrol(fr1, "style", "text", "string", "some text", "position", [10 10 200 30], "horizontalalignment", "center", "tag", "label");
402 r1 = "r1: " + string(get("radio1", "value")) + " ";
403 r2 = "r2: " + string(get("radio2", "value")) + " ";
404 c1 = "c1: " + string(get("check1", "value")) + " ";
405 c2 = "c2: " + string(get("check2", "value")) + " ";
406 t1 = "t1: " + string(get("tabs", "value"));
410 set("label", "string", r1+r2+c1+c2+t1);
413 f.position = [200 200 240 460];
416 fr1 = uicontrol(f, "style", "frame", "units", "normalized", "position", [0.02 0.02 0.96 0.96], "border", createBorder("etched"));
418 checkbox1 = uicontrol(fr1, "style", "checkbox", "string", "Checkbox 1", "units", "normalized", "position", [0.02 0.9 0.96 0.09], "tag", "check1");
419 checkbox2 = uicontrol(fr1, "style", "checkbox", "string", "Checkbox 2", "units", "normalized", "position", [0.02 0.8 0.96 0.09], "tag", "check2");
420 editbox = uicontrol(fr1, "style", "edit", "string", "Edit", "units", "normalized", "position", [0.02 0.7 0.96 0.09]);
421 button = uicontrol(fr1, "style", "pushbutton", "string", "Pushbutton", "units", "normalized", "position", [0.02 0.6 0.96 0.09], "callback", "onPush");
422 radio1 = uicontrol(fr1, "style", "radiobutton", "string", "Radio 1", "units", "normalized", "position", [0.02 0.5 0.96 0.09], "groupname", "radio", "tag", "radio1");
423 radio2 = uicontrol(fr1, "style", "radiobutton", "string", "Radio 2", "units", "normalized", "position", [0.02 0.4 0.96 0.09], "groupname", "radio", "tag", "radio2");
424 combo = uicontrol(fr1, "style", "popupmenu", "string", "popupmenu1|popupmenu2|popupmenu3|popupmenu4", "units", "normalized", "position", [0.02 0.3 0.96 0.09]);
426 tab = uicontrol(fr1, "style", "tab", "units", "normalized", "position", [0.02 0.1 0.96 0.195], "tag", "tabs");
427 tab3 = uicontrol(tab, "style", "frame", "string", "Blue", "backgroundcolor", [0 0 1]);
428 tab2 = uicontrol(tab, "style", "frame", "string", "Green", "backgroundcolor", [0 1 0]);
429 tab1 = uicontrol(tab, "style", "frame", "string", "Red", "backgroundcolor", [1 0 0]);
431 label = uicontrol(fr1, "style", "text", "string", "some text", "units", "normalized", "position", [0.02 0.005 0.96 0.09], "horizontalalignment", "center", "tag", "label");
437 f.figure_name = "My first plot";
438 f.position = [100, 100, 500, 400];
440 fr = uicontrol(f, "style", "frame", "position", [0, 0, 500, 400]);
448 exec("SCI/contrib/sanofi-opticlim/loader.sce");