bug #13397 fixed - saveGui() returned an undocumented boolean parameter (success...
[scilab.git] / scilab / modules / gui / help / en_US / saveGui.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="saveGui" xml:lang="en">
3     <refnamediv>
4         <refname>saveGui</refname>
5         <refpurpose>Save a graphic user interface in a file</refpurpose>
6     </refnamediv>
7     <refsynopsisdiv>
8         <title>Calling Sequence</title>
9         <synopsis>saveGui(fig, filename)</synopsis>
10     </refsynopsisdiv>
11     <refsection>
12         <title>Arguments</title>
13         <variablelist>
14             <varlistentry>
15                 <term>fig</term>
16                 <listitem>
17                     <para>handle, the handle of the current figure</para>
18                 </listitem>
19             </varlistentry>
20             <varlistentry>
21                 <term>filename</term>
22                 <listitem>
23                     <para>character string containing the path of the file</para>
24                 </listitem>
25             </varlistentry>
26         </variablelist>
27     </refsection>
28     <refsection>
29         <title>Description</title>
30         <para>
31             The <literal>saveGui</literal> function can be used to save a graphic user interface in a file and reloaded by the
32             <literal>
33                 <link linkend="loadGui">loadGui</link>
34             </literal>
35             function.
36         </para>
37         <para>
38             <literal>saveGui(f, filename)</literal> save a current graphic handle f in file
39             defined by <literal>filename</literal>. If the operation failed an error message in the Scilab console will be printed.
40         </para>
41     </refsection>
42     <refsection>
43         <title>Examples</title>
44         <programlisting role="example"><![CDATA[ 
45 // First example
46 f = figure("background", -2);
47 h = uicontrol(f, "style", "text", ...
48               "string", "This is a figure", ...
49               "position", [210 180 300 100], ...
50               "fontsize", 24, ...
51               "backgroundcolor", [1 1 1]);
52
53 saveGui(f, fullfile(TMPDIR, "foo"))
54 close(f)
55 loadGui(fullfile(TMPDIR, "foo"));
56
57 // Second example
58 f = figure("default_axes", "off", ...
59            "dockable", "off", ...
60            "figure_name", "Sélection", ...
61            "axes_size", [200 200], ...
62            "infobar_visible", "off", ...
63            "menubar_visible", "off", ...
64            "toolbar", "none", ...
65            "toolbar_visible", "off", ...
66            "layout", "gridbag");
67            
68 h1 = uicontrol(f, "style", "text", ...
69                 "string", "Following List :", ...
70                 "fontsize", 15, ...
71                 "constraints", createConstraints("gridbag", [1 1 2 1], [1 0], "both"));
72                 
73 h2 = uicontrol(f, "style", "popupmenu", ...
74                 "string", ["item1"; "item2"; "item3"], ...
75                 "value", 1, ...
76                 "fontsize", 15, ...
77                 "constraints", createConstraints("gridbag", [1 2 2 1], [1 0], "both"), ...
78                 "tag", "selection");
79                 
80 h3 = uicontrol(f, "style", "pushbutton", ...
81                 "string", "OK", ...
82                 "callback", "obj = findobj(""tag"", ""selection""); mprintf(""La valeur sélectionnée est : %s.\n"", obj.string(obj.value)); close(gcf())", ...
83                 "fontsize", 15, ...
84                 "constraints", createConstraints("gridbag", [1 3 1 1], [1 0], "both", "left"));
85                 
86 h4 = uicontrol(f, "style", "pushbutton", ...
87                 "string", "CANCEL", ...
88                 "callback", "close(gcf())", ...
89                 "fontsize", 15, ...
90                 "constraints", createConstraints("gridbag", [2 3 1 1], [1 0], "both", "right"));
91                 
92 saveGui(f, "TMPDIR/foo2.xml");
93 close(f)
94 loadGui("TMPDIR/foo2.xml")
95
96  ]]></programlisting>
97     </refsection>
98     <refsection role="see also">
99         <title>See Also</title>
100         <simplelist type="inline">
101             <member>
102                 <link linkend="loadGui">loadGui</link>
103             </member>
104             <member>
105                 <link linkend="load">load</link>
106             </member>
107             <member>
108                 <link linkend="save">save</link>
109             </member>
110         </simplelist>
111     </refsection>
112     <refsection>
113         <title>History</title>
114         <revhistory>
115             <revision>
116                 <revnumber>5.5.0</revnumber>
117                 <revremark>
118                     Function <function>saveGui</function> introduced.
119                 </revremark>
120             </revision>
121         </revhistory>
122     </refsection>
123 </refentry>