<?xml version="1.0" encoding="UTF-8"?>
<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">
    <refnamediv>
        <refname>saveGui</refname>
        <refpurpose>Save a graphic user interface in a file</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>saveGui(fig, filename)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>fig</term>
                <listitem>
                    <para>handle, the handle of the current figure</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>filename</term>
                <listitem>
                    <para>character string containing the path of the file</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            The <literal>saveGui</literal> function can be used to save a graphic user interface in a file and reloaded by the
            <literal>
                <link linkend="loadGui">loadGui</link>
            </literal>
            function.
        </para>
        <para>
            <literal>saveGui(f, filename)</literal> save a current graphic handle f in file
            defined by <literal>filename</literal>. If the operation failed an error message in the Scilab console will be printed.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
// First example
f = figure("background", -2);
h = uicontrol(f, "style", "text", ...
              "string", "This is a figure", ...
              "position", [210 180 300 100], ...
              "fontsize", 24, ...
              "backgroundcolor", [1 1 1]);

saveGui(f, fullfile(TMPDIR, "foo"))
close(f)
loadGui(fullfile(TMPDIR, "foo"));

// Second example
f = figure("default_axes", "off", ...
           "dockable", "off", ...
           "figure_name", "Sélection", ...
           "axes_size", [200 200], ...
           "infobar_visible", "off", ...
           "menubar_visible", "off", ...
           "toolbar", "none", ...
           "toolbar_visible", "off", ...
           "layout", "gridbag");

h1 = uicontrol(f, "style", "text", ...
                "string", "Following List :", ...
                "fontsize", 15, ...
                "constraints", createConstraints("gridbag", [1 1 2 1], [1 0], "both"));

h2 = uicontrol(f, "style", "popupmenu", ...
                "string", ["item1"; "item2"; "item3"], ...
                "value", 1, ...
                "fontsize", 15, ...
                "constraints", createConstraints("gridbag", [1 2 2 1], [1 0], "both"), ...
                "tag", "selection");

h3 = uicontrol(f, "style", "pushbutton", ...
                "string", "OK", ...
                "callback", "obj = findobj(""tag"", ""selection""); mprintf(""La valeur sélectionnée est : %s.\n"", obj.string(obj.value)); close(gcf())", ...
                "fontsize", 15, ...
                "constraints", createConstraints("gridbag", [1 3 1 1], [1 0], "both", "left"));

h4 = uicontrol(f, "style", "pushbutton", ...
                "string", "CANCEL", ...
                "callback", "close(gcf())", ...
                "fontsize", 15, ...
                "constraints", createConstraints("gridbag", [2 3 1 1], [1 0], "both", "right"));

saveGui(f, "TMPDIR/foo2.xml");
close(f)
loadGui("TMPDIR/foo2.xml")

 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="loadGui">loadGui</link>
            </member>
            <member>
                <link linkend="load">load</link>
            </member>
            <member>
                <link linkend="save">save</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>5.5.0</revnumber>
                <revremark>
                    Function <function>saveGui</function> introduced.
                </revremark>
            </revision>
        </revhistory>
    </refsection>
</refentry>
