GUI demos: separated and reworked the 'dialogs' demos 16/14116/3
Paul Bignier [Mon, 24 Mar 2014 16:54:06 +0000 (17:54 +0100)]
Change-Id: I0a30e50c681a748364aadff70e9047533a65bc15

scilab/modules/gui/demos/dialogs/dialog.dem.sce [moved from scilab/modules/gui/demos/dialog.dem.sce with 99% similarity]
scilab/modules/gui/demos/dialogs/dialogs.dem.gateway.sce [new file with mode: 0644]
scilab/modules/gui/demos/dialogs/messagebox.sce [new file with mode: 0644]
scilab/modules/gui/demos/dialogs/x_choose.sce [new file with mode: 0644]
scilab/modules/gui/demos/dialogs/x_dialog.sce [new file with mode: 0644]
scilab/modules/gui/demos/dialogs/x_mdialog.sce [new file with mode: 0644]
scilab/modules/gui/demos/gui.dem.gateway.sce

similarity index 99%
rename from scilab/modules/gui/demos/dialog.dem.sce
rename to scilab/modules/gui/demos/dialogs/dialog.dem.sce
index 94c0b70..cff032b 100644 (file)
@@ -30,4 +30,3 @@ n=5;m=4;mat=rand(n,m);
 row="row";labelv=row(ones(1,n))+string(1:n);
 col="col";labelh=col(ones(1,m))+string(1:m);
 new=evstr(x_mdialog("Matrix to edit",labelv,labelh,string(mat)))
-
diff --git a/scilab/modules/gui/demos/dialogs/dialogs.dem.gateway.sce b/scilab/modules/gui/demos/dialogs/dialogs.dem.gateway.sce
new file mode 100644 (file)
index 0000000..b27df7f
--- /dev/null
@@ -0,0 +1,11 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Paul Bignier
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+subdemolist = [_("messagebox"), "messagebox.sce"; ...
+_("x_choose"),  "x_choose.sce"; ...
+_("x_dialog"),  "x_dialog.sce"; ...
+_("x_mdialog"), "x_mdialog.sce"];
+
+subdemolist(:,2) = SCI + "/modules/gui/demos/dialogs/"+ subdemolist(:,2);
diff --git a/scilab/modules/gui/demos/dialogs/messagebox.sce b/scilab/modules/gui/demos/dialogs/messagebox.sce
new file mode 100644 (file)
index 0000000..fe22d11
--- /dev/null
@@ -0,0 +1,22 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Paul Bignier
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+function demo_messagebox()
+
+    res = messagebox(_(["Simple example of message";
+    "First row of comments";
+    "Second row";
+    "etc...";]), _("Title"), "info", _(["Button 1" "Button 2"]), "modal");
+
+    if res == 1 then
+        disp(_("Button 1 clicked."));
+    else
+        disp(_("Button 2 clicked"));
+    end
+
+endfunction
+
+demo_messagebox()
+clear demo_messagebox;
diff --git a/scilab/modules/gui/demos/dialogs/x_choose.sce b/scilab/modules/gui/demos/dialogs/x_choose.sce
new file mode 100644 (file)
index 0000000..e11f447
--- /dev/null
@@ -0,0 +1,18 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Paul Bignier
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+function demo_x_choose()
+
+    res = x_choose(["item1";"item2";"item3";"item4";"item5";"item6";..
+    "item7";"item8";"item9";"item10"],..
+    _("Message: Selection (double-click on an item --> returns the item number)"),..
+    _("Cancel"));
+
+    disp(_("Item selected: "+string(res)));
+
+endfunction
+
+demo_x_choose()
+clear demo_x_choose;
diff --git a/scilab/modules/gui/demos/dialogs/x_dialog.sce b/scilab/modules/gui/demos/dialogs/x_dialog.sce
new file mode 100644 (file)
index 0000000..2264beb
--- /dev/null
@@ -0,0 +1,15 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Paul Bignier
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+function demo_x_dialog()
+
+    res = x_dialog(_("Message: enter a value"), "3.1592653");
+
+    disp(_("Value entered: "+string(res)));
+
+endfunction
+
+demo_x_dialog()
+clear demo_x_dialog;
diff --git a/scilab/modules/gui/demos/dialogs/x_mdialog.sce b/scilab/modules/gui/demos/dialogs/x_mdialog.sce
new file mode 100644 (file)
index 0000000..625f67e
--- /dev/null
@@ -0,0 +1,29 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Paul Bignier
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+function demo_x_mdialog()
+
+    res = x_mdialog(_(["Message";...
+    "(edit the boxes below --> output: edited boxes)"]),...
+    _(["first row";"second row";"etc..."]),...
+    ["10";"20";"30"]);
+
+    disp(_("Values entered: "+res(1)+" "+res(2)+" "+res(3)));
+
+    n = 5;
+    m = 4;
+    mat = rand(n, m);
+    row = _("row");
+    labelv = row(ones(1, n))+string(1:n);
+    col = _("col");
+    labelh = col(ones(1, m))+string(1:m);
+    res = evstr(x_mdialog(_("Matrix to edit"), labelv, labelh, string(mat)));
+
+    disp(res, _("Matrix entered: "));
+
+endfunction
+
+demo_x_mdialog()
+clear demo_x_mdialog;
index d81d1ba..4a387bb 100644 (file)
@@ -11,7 +11,7 @@ function subdemolist = demo_gateway()
     demopath = get_absolute_file_path("gui.dem.gateway.sce");
     add_demo(gettext("GUI"), demopath + "gui.dem.gateway.sce");
 
-    subdemolist = [_("Dialogs")   ,"dialog.dem.sce" ; ..
+    subdemolist = [_("Dialogs")   ,"dialogs/dialogs.dem.gateway.sce" ; ..
     _("Uicontrols 1") ,"uicontrol.dem.sce" ];
 
     subdemolist = [ subdemolist ;