3 //3 spinner and sliders
11 //11 opticlim uicontrol
19 f1.position(3:4) = [250, 100];
21 uicontrol(f1, "position", [25 25 50 50], "string", "+1", "callback", "v = eval(get(''num'', ''string''));set(''num'', ''string'', string(v + 1));");
22 uicontrol(f1, "position", [100 25 50 50], "string", "0", "tag", "num", "callback", "set(''num'', ''string'', ''0'');");
23 uicontrol(f1, "position", [175 25 50 50], "string", "-1", "callback", "v = eval(get(''num'', ''string''));set(''num'', ''string'', string(v - 1));");
30 f2.position(3:4) = [50 * dim + 50, 50 * dim + 125];
32 x = floor((i-1) / dim);
33 y = modulo((i-1), dim);
34 uicontrol(f2, "position", [25 + 50*x, 100 + 50*y,50,50],"string", string(x) + " - " + string(y), "callback", "set(gcbo, ''enable'', %f)");
37 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");
46 minval = get("min", "value");
47 maxval = get("max", "value");
48 set("slider", "value", string(((maxval - minval) / 2) + minval));
52 set("slider", "min", get("min", "value"));
53 step = get("step", "value");
54 set("slider", "sliderstep", [step, step*10]);
55 set("slider", "max", get("max", "value"));
60 f.position(3:4) = [300, 200];
62 uicontrol("style", "text", "string", "0", "position", [120, 160, 60, 20], "horizontalalignment", "center", "tag", "val");
63 uicontrol("style", "slider", "position", [10 120 280 30], "min", -100, "max", 100, "sliderstep", [1, 1], "value", 0, "tag", "slider");
65 uicontrol("style", "text", "string", "min", "position", [25 80 50 20], "horizontalalignment", "center");
66 uicontrol("style", "text", "string", "step", "position", [125 80 50 20], "horizontalalignment", "center");
67 uicontrol("style", "text", "string", "max", "position", [225 80 50 20], "horizontalalignment", "center");
69 uicontrol("style", "spinner", "min", -100, "max", 0, "sliderstep", [1, 1], "value", "-100", "position", [25 50 50 20], "horizontalalignment", "center", "tag", "min");
70 uicontrol("style", "spinner", "min", 1, "max", 10, "sliderstep", [1, 1], "value", "1", "position", [125 50 50 20], "horizontalalignment", "center", "tag", "step");
71 uicontrol("style", "spinner", "min", 0, "max", 100, "sliderstep", [1, 1], "value", "100", "position", [225 50 50 20], "horizontalalignment", "center", "tag", "max");
73 uicontrol("style", "pushbutton", "string", "reset", "position", [100 10 100 30], "callback", "reset");
76 set("slider", "callback", "val = gcbo.value;set(""val"", ""string"", string(val));");
77 set("min", "callback", "onchange");
78 set("step", "callback", "onchange");
79 set("max", "callback", "onchange");
86 f.position = [200 200 240 470];
89 fr1 = uicontrol("style", "frame", "position", [10 10 220 450], "border", createBorder("etched"));
90 spinner = uicontrol(fr1, "style", "spinner", "string", "0", "position", [10 410 200 30], "horizontalalignment", "right", "min", 0, "max", 5);
91 label = uicontrol(fr1, "style", "text", "string", "usedeprecatedskin=""off""", "position", [10 370 200 30], "backgroundcolor", [1 0 1]);
92 editbox = uicontrol(fr1, "style", "edit", "string", "Edit", "position", [10 330 200 30], "backgroundcolor", [1 0 0]);
93 button = uicontrol(fr1, "style", "pushbutton", "string", "Pushbutton", "position", [10 290 200 30]);
94 checkbox = uicontrol(fr1, "style", "checkbox", "string", "Checkbox", "position", [10 250 200 30]);
95 radio = uicontrol(fr1, "style", "radiobutton", "string", "Radiobutton", "position", [10 210 200 30]);
96 slider = uicontrol(fr1, "style", "slider", "position", [10 150 200 50]);
97 frame = uicontrol(fr1, "style", "frame", "position", [10 110 200 30], "backgroundcolor", [0.5 0.5 0.5]);
98 listbox = uicontrol(fr1, "style", "listbox", "string", "listbox1|listbox2|listbox3|listbox4|listbox5", "position", [10 50 200 50], "backgroundcolor", [0.2 0.2 0.2]);
99 combo = uicontrol(fr1, "style", "popupmenu", "string", "popupmenu1|popupmenu2", "position", [10 10 200 30], "backgroundcolor", [0.8 0.8 0.8]);
107 R = get("sliderR", "value");
108 G = get("sliderG", "value");
109 B = get("sliderB", "value");
110 set("textR", "string", string(R));
111 set("textG", "string", string(G));
112 set("textB", "string", string(B));
113 set("color", "backgroundcolor", [R, G, B]/255);
119 f.position(3:4) = [300, 130];
121 uicontrol("style", "slider", "position", [10 10 128 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderB");
122 uicontrol("style", "slider", "position", [10 50 128 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderG");
123 uicontrol("style", "slider", "position", [10 90 128 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderR");
125 uicontrol("style", "text", "position", [150 15 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textB");
126 uicontrol("style", "text", "position", [150 55 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textG");
127 uicontrol("style", "text", "position", [150 95 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textR");
129 uicontrol("style", "frame", "position", [200 20 90 90], "tag", "color", "backgroundcolor", [0, 0, 0]);
131 set("sliderR", "callback", "onChange");
132 set("sliderG", "callback", "onChange");
133 set("sliderB", "callback", "onChange");
142 R = get("sliderR", "value");
143 G = get("sliderG", "value");
144 B = get("sliderB", "value");
145 set("textR", "string", string(R));
146 set("textG", "string", string(G));
147 set("textB", "string", string(B));
148 set("color", "backgroundcolor", [R, G, B]/255);
153 f1.position = [100, 100, 350, 130];
154 f1.figure_name = "sliders";
156 uicontrol(f1, "style", "slider", "position", [10 10 256 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderB");
157 uicontrol(f1, "style", "slider", "position", [10 50 256 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderG");
158 uicontrol(f1, "style", "slider", "position", [10 90 256 30], "min", 0, "max", 255, "sliderstep", [1, 10], "value", 0, "tag", "sliderR");
160 uicontrol(f1, "style", "text", "position", [300 15 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textB");
161 uicontrol(f1, "style", "text", "position", [300 55 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textG");
162 uicontrol(f1, "style", "text", "position", [300 95 40 20], "string", "0", "backgroundcolor", [1, 1, 1], "horizontalalignment", "center", "tag", "textR");
165 f2.position = [450, 100, 130, 130];
166 f2.figure_name = "RGB";
167 uicontrol(f2, "style", "frame", "position", [15 15 100 100], "tag", "color", "backgroundcolor", [0, 0, 0]);
169 set("sliderR", "callback", "onChange");
170 set("sliderG", "callback", "onChange");
171 set("sliderB", "callback", "onChange");
179 f.layout_options = createLayoutOptions("border", [10, 20]);
180 //f.layout_options = createLayoutOptions("border");
182 c = createConstraints("border", "top", [50,20]);
191 u_grid1 = uicontrol(f,...
193 "backgroundcolor", [1 0 0], ...
199 u_grid2 = uicontrol(f,...
201 "backgroundcolor", [0 1 0], ...
206 c.position = "center";
207 u_grid3 = uicontrol(f,...
209 "backgroundcolor", [0 0 1], ...
214 c.preferredsize = [100, 100];
215 c.position = "right";
216 u_grid4 = uicontrol(f,...
218 "backgroundcolor", [1 1 0], ...
223 c.position = "bottom";
224 u_grid5 = uicontrol(f,...
226 "backgroundcolor", [1 0 1], ...
234 f.position = [200 200 200 100];
235 f.layout = "gridbag";
237 c = createConstraints("gridbag",[1, 1, 1, 1], [1, 1], "both", "center", [0, 0], [50, 50]);
239 redf_grid = [1, 1, 1, 1];
240 greenf_grid = [1, 2, 1, 1];
241 bluef_grid = [1, 3, 2, 1];
242 yelf_grid = [2, 1, 1, 2];
243 magf_grid = [3, 1, 1, 1];
244 cyanf_grid = [3, 2, 1, 2];
247 u_grid3 = uicontrol(f , ...
248 "style" , "frame", ...
249 "backgroundcolor" , [0 0 1], ...
253 u_grid1 = uicontrol(f , ...
254 "style" , "frame", ...
255 "backgroundcolor" , [0 1 1], ...
259 u_grid1 = uicontrol(f , ...
260 "style" , "frame" , ...
261 "backgroundcolor" , [1 0 0] , ...
264 c.grid = greenf_grid;
265 u_grid2 = uicontrol(f , ...
266 "style" , "frame", ...
267 "backgroundcolor" , [0 1 0], ...
271 u_grid4 = uicontrol(f , ...
272 "style" , "frame", ...
273 "backgroundcolor" , [1 1 0], ...
277 u_grid5 = uicontrol(f , ...
278 "style" , "frame", ...
279 "backgroundcolor" , [1 0 1], ...
290 set("push", "string", string(get("tab", "value")));
294 f.position = [200 200 400 300];
296 tab = uicontrol(f, "style", "tab", "tag", "tab", "position", [0 30 400, 270]);
298 tab3 = uicontrol(tab, "style", "frame", "string", "Blue", "layout", "border", "backgroundcolor", [0 0 1]);
299 tab2 = uicontrol(tab, "style", "frame", "string", "Green", "layout", "border", "backgroundcolor", [0 1 0]);
300 tab1 = uicontrol(tab, "style", "frame", "string", "Red", "layout", "border", "backgroundcolor", [1 0 0]);
302 uicontrol(f, "style", "pushbutton", "string", "push me", "callback", "onPush", "tag", "push", "position", [150 0 100 30]);
304 set("tab", "value", 1);
309 fig_pregui = figure("figure_name", "OPTICLIM - site and weather selection", ...
310 "dockable", "off", ...
311 "axes_size", [500,170], ...
312 "infobar_visible", "off", ...
313 "toolbar", "none", ...
314 "menubar_visible", "on", ...
315 "menubar", "none", ...
316 "default_axes", "off", ...
318 "layout", "border", ...
319 "background", color(244,244,244), ...
320 "tag", "figure_preopticlim", ...
323 //b1 = createBorder("titled", createBorder("etched"), "Choose your site:", "left", "top", createBorderFont("", 11, "bold"), "black");
325 OpticlimPath = "E:\git\toolbox\sanofi-opticlim\";
326 f = uicontrol(fig_pregui, "style", "frame", ...
328 //font1 = createBorderFont("", 11, "bold");
329 //b1 = createBorder("titled", createBorder("etched"), _d("OPTICLIM", "Choose your site")+":", "left", "top", font1, "black");
330 f1 = uicontrol(f, "style", "frame", ...
331 "layout", "gridbag", ...
332 "constraints", createConstraints("gridbag", [1 1 3 1], [1 1], "both", "left"), ...
334 uicontrol(f1, "style", "popupmenu", "string", [], ...
336 "horizontalAlignment", "center", ...
337 "margins", [0,5,0,5], ...
338 "tag", "site_list", ...
339 "callback", "cbChangeSite", ...
340 "constraints", createConstraints("gridbag", [1 1 1 1], [5 1], "horizontal", "left", [0,0], [330,22]));
341 path_icon = OpticlimPath+"pictures/list-add.png";
342 uicontrol(f1, "style", "pushbutton", "string", "", ...
344 "horizontalAlignment", "center", ...
345 "icon", path_icon, ...
346 "margins", [0,5,0,5], ...
347 "callback", "cbAddSite", ...
348 "constraints", createConstraints("gridbag", [2 1 1 1], [1 1], "horizontal", "left"));
351 fig_pregui.visible = "on";
360 set("tabs", "value", 2);
363 r1 = "r1: " + string(get("radio1", "value")) + " ";
364 r2 = "r2: " + string(get("radio2", "value")) + " ";
365 c1 = "c1: " + string(get("check1", "value")) + " ";
366 c2 = "c2: " + string(get("check2", "value")) + " ";
367 t1 = "t1: " + string(get("tabs", "value"));
371 set("label", "string", r1+r2+c1+c2+t1);
375 f.position = [200 200 240 460];
378 fr1 = uicontrol("style", "frame", "position", [10 10 220 440], "border", createBorder("etched"));
379 checkbox1 = uicontrol(fr1, "style", "checkbox", "string", "Checkbox 1", "position", [10 400 200 30], "tag", "check1");
380 checkbox2 = uicontrol(fr1, "style", "checkbox", "string", "Checkbox 2", "position", [10 370 200 30], "tag", "check2");
381 editbox = uicontrol(fr1, "style", "edit", "string", "Edit", "position", [10 330 200 30]);
382 frame = uicontrol(fr1, "style", "frame", "position", [10 270 200 50]);
383 button = uicontrol(fr1, "style", "pushbutton", "string", "Pushbutton", "position", [10 230 200 30], "callback", "onPush");
384 radio1 = uicontrol(fr1, "style", "radiobutton", "string", "Radio 1", "position", [10 190 200 30], "groupname", "radio", "tag", "radio1");
385 radio2 = uicontrol(fr1, "style", "radiobutton", "string", "Radio 2", "position", [10 160 200 30], "groupname", "radio", "tag", "radio2");
386 combo = uicontrol(fr1, "style", "popupmenu", "string", "popupmenu1|popupmenu2|popupmenu3|popupmenu4", "position", [10 120 200 30]);
388 tab = uicontrol(fr1, "style", "tab", "position", [10 50 200 60], "tag", "tabs");
389 tab3 = uicontrol(tab, "style", "frame", "string", "Blue", "backgroundcolor", [0 0 1]);
390 tab2 = uicontrol(tab, "style", "frame", "string", "Green", "backgroundcolor", [0 1 0]);
391 tab1 = uicontrol(tab, "style", "frame", "string", "Red", "backgroundcolor", [1 0 0]);
393 label = uicontrol(fr1, "style", "text", "string", "some text", "position", [10 10 200 30], "horizontalalignment", "center", "tag", "label");
400 r1 = "r1: " + string(get("radio1", "value")) + " ";
401 r2 = "r2: " + string(get("radio2", "value")) + " ";
402 c1 = "c1: " + string(get("check1", "value")) + " ";
403 c2 = "c2: " + string(get("check2", "value")) + " ";
404 t1 = "t1: " + string(get("tabs", "value"));
408 set("label", "string", r1+r2+c1+c2+t1);
411 f.position = [200 200 240 460];
414 fr1 = uicontrol(f, "style", "frame", "units", "normalized", "position", [0.02 0.02 0.96 0.96], "border", createBorder("etched"));
416 checkbox1 = uicontrol(fr1, "style", "checkbox", "string", "Checkbox 1", "units", "normalized", "position", [0.02 0.9 0.96 0.09], "tag", "check1");
417 checkbox2 = uicontrol(fr1, "style", "checkbox", "string", "Checkbox 2", "units", "normalized", "position", [0.02 0.8 0.96 0.09], "tag", "check2");
418 editbox = uicontrol(fr1, "style", "edit", "string", "Edit", "units", "normalized", "position", [0.02 0.7 0.96 0.09]);
419 button = uicontrol(fr1, "style", "pushbutton", "string", "Pushbutton", "units", "normalized", "position", [0.02 0.6 0.96 0.09], "callback", "onPush");
420 radio1 = uicontrol(fr1, "style", "radiobutton", "string", "Radio 1", "units", "normalized", "position", [0.02 0.5 0.96 0.09], "groupname", "radio", "tag", "radio1");
421 radio2 = uicontrol(fr1, "style", "radiobutton", "string", "Radio 2", "units", "normalized", "position", [0.02 0.4 0.96 0.09], "groupname", "radio", "tag", "radio2");
422 combo = uicontrol(fr1, "style", "popupmenu", "string", "popupmenu1|popupmenu2|popupmenu3|popupmenu4", "units", "normalized", "position", [0.02 0.3 0.96 0.09]);
424 tab = uicontrol(fr1, "style", "tab", "units", "normalized", "position", [0.02 0.1 0.96 0.195], "tag", "tabs");
425 tab3 = uicontrol(tab, "style", "frame", "string", "Blue", "backgroundcolor", [0 0 1]);
426 tab2 = uicontrol(tab, "style", "frame", "string", "Green", "backgroundcolor", [0 1 0]);
427 tab1 = uicontrol(tab, "style", "frame", "string", "Red", "backgroundcolor", [1 0 0]);
429 label = uicontrol(fr1, "style", "text", "string", "some text", "units", "normalized", "position", [0.02 0.005 0.96 0.09], "horizontalalignment", "center", "tag", "label");
434 exec("SCI/contrib/sanofi-opticlim/loader.sce");