<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 29/11/2019 à 19:17, Claus Futtrup a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:2e1d3532-08a5-9da6-5785-ed1df2403a98@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="moz-cite-prefix">Hi Stéphane</div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">Hm, you're right. This actually fixes
        the problem, but I do find it to be a strange "solution" that
        you write each of them to be equal with itself ... I prefer
        calling the set() function.<br>
      </div>
    </blockquote>
    <p>In "ge_fs=ge_fs" the lhs is a local copy and the rhs the variable
      in the calling context.<br>
    </p>
    <blockquote type="cite"
      cite="mid:2e1d3532-08a5-9da6-5785-ed1df2403a98@gmail.com">
      <div class="moz-cite-prefix"> </div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">Cheers,<br>
      </div>
      <div class="moz-cite-prefix">Claus<br>
      </div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">On 29.11.2019 19:05, Stéphane
        Mottelet wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:c4ca3e8f-1f2a-1d2c-0e10-ba08d05cad05@utc.fr">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        To makeit work, just insert<br>
        <br>
        ge_r=ge_r;<br>
        ge_fs=ge_fs;<br>
        ge_hz=ge_hz;<br>
        <p>at the begining of function calc.</p>
        My two cents...<br>
        <p>S.</p>
        <p><br>
        </p>
        <div class="moz-cite-prefix">Le 29/11/2019 à 18:58, Claus
          Futtrup a écrit :<br>
        </div>
        <blockquote type="cite"
          cite="mid:fd2317a9-c694-6649-043e-438be72e23fa@gmail.com">
          <meta http-equiv="Content-Type" content="text/html;
            charset=UTF-8">
          <div class="moz-cite-prefix">Hi Antoine</div>
          <div class="moz-cite-prefix"><br>
          </div>
          <div class="moz-cite-prefix">
            <pre class="moz-quote-pre" wrap="">>Not much progress because I never managed to get a minimal working example</pre>
          </div>
          <div class="moz-cite-prefix">I can repeat my example again and
            again. It never works. Please see it below.</div>
          <div class="moz-cite-prefix"><br>
          </div>
          <div class="moz-cite-prefix">Do you agree. This consistently
            fails if you run it from Scinotes editor ... but if I copy
            e.g. <span style="color:rgb(0,0,0);">ge_r</span><span
              style="color:rgb(92,92,92);">.</span><span
              style="color:rgb(170,170,170);">visible</span> <span
              style="color:rgb(92,92,92);">=</span> <span
              style="color:rgb(188,143,143);">"</span><span
              style="color:rgb(188,143,143);">on</span><span
              style="color:rgb(188,143,143);">"</span> to the command
            line (not from within the calc function), then it shows up.</div>
          <div class="moz-cite-prefix"><br>
          </div>
          <div class="moz-cite-prefix">/Claus</div>
          <div class="moz-cite-prefix"><br>
          </div>
          <div class="moz-cite-prefix">
            <pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(100,174,100);font-style:italic;">// BAD_GUI_EXAMPLE.SCE</span>
<span style="color:rgb(100,174,100);font-style:italic;">//</span>
<span style="color:rgb(100,174,100);font-style:italic;">// Demo of how _NOT_ to build a simple GUI in Scilab.</span>

<span style="color:rgb(100,174,100);font-style:italic;">// Initialize variables</span>
<span style="color:rgb(0,0,0);">m</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// Moving mass </span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">m</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;"> (kilogram)</span>
<span style="color:rgb(0,0,0);">k</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// Stiffness, spring constant </span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">k</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;"> (Newton per meter)</span>
<span style="color:rgb(0,0,0);">fres</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// Resonance frequency (Hertz)</span>

<span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(0,0,0);text-decoration:underline;">calc</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
    <span style="color:rgb(0,0,0);">m</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">evstr</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">get</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">ge_m</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// get content in uicontrol ge_m</span>
    <span style="color:rgb(0,0,0);">k</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">evstr</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">get</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">ge_k</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// get content in uicontrol ge_k</span>
    <span style="color:rgb(0,0,0);">fres</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(50,185,185);">sqrt</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">k</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(0,0,0);">m</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(92,92,92);">*</span><span style="color:rgb(218,112,214);">%pi</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
    <span style="color:rgb(100,174,100);font-style:italic;">// putting GUI updates inside the calculation routine is not pretty code.</span>
    <span style="color:rgb(0,0,0);">ge_r</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">visible</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">on</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span>
    <span style="color:rgb(0,0,0);">ge_fs</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">visible</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">on</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span>       <span style="color:rgb(100,174,100);font-style:italic;">// THIS DOESN</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">T WORK</span>
    <span style="color:rgb(0,0,0);">ge_hz</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">visible</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">on</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">//    set(ge_r,</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">Visible</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">,</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">on</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">); // THIS WORKS</span>
<span style="color:rgb(100,174,100);font-style:italic;">//    set(ge_fs,</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">Visible</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">,</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">on</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">);</span>
<span style="color:rgb(100,174,100);font-style:italic;">//    set(ge_hz,</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">Visible</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">,</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">on</span><span style="color:rgb(100,174,100);font-style:italic;">"</span><span style="color:rgb(100,174,100);font-style:italic;">);</span>
    <span style="color:rgb(100,174,100);font-style:italic;">// update global variables</span>
    <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(0,0,0);">m</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">k</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">fres</span><span style="color:rgb(0,0,0);"></span><span style="color:rgb(0,0,0);"></span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(95,158,160);">return</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">m</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">k</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">fres</span><span style="color:rgb(0,0,0);"></span><span style="color:rgb(0,0,0);"></span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(176,24,19);">endfunction</span>

<span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(0,0,0);text-decoration:underline;">goodbye</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
    <span style="color:rgb(0,0,0);">close</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">ge</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// Close GUI window</span>
    <span style="color:rgb(50,185,185);">printf</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Resulting fres: %f Hertz\n</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">fres</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
    <span style="color:rgb(95,158,160);">abort</span> <span style="color:rgb(100,174,100);font-style:italic;">// Print result in console (e.g. for copy/paste), then kill the app</span>
<span style="color:rgb(176,24,19);">endfunction</span>

<span style="color:rgb(0,0,0);">ge</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">scf</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// GUI Example, Initialize and </span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">set current figure</span><span style="color:rgb(100,174,100);font-style:italic;">'</span>
<span style="color:rgb(0,0,0);">as</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">ge</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">axes_size</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// read size of window, as = [width height]</span>
<span style="color:rgb(0,0,0);">ge</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">figure_name</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">GUI Example</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// Change window header</span>

<span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">text</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Moving mass :</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">10</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">35</span> <span style="color:rgb(188,143,143);">80</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">background</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">1</span> <span style="color:rgb(188,143,143);">1</span> <span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// white background</span>
          <span style="color:rgb(100,174,100);font-style:italic;">// position properties has four parameters = x,y,width,height</span>
          <span style="color:rgb(100,174,100);font-style:italic;">// y-position counts from lower left corner, so we subtract from </span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">as</span><span style="color:rgb(100,174,100);font-style:italic;">'</span>
<span style="color:rgb(0,0,0);">ge_m</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">edit</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(50,185,185);">string</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">m</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">100</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">35</span> <span style="color:rgb(188,143,143);">80</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">text</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);"> kg </span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">200</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">35</span> <span style="color:rgb(188,143,143);">30</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">background</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">1</span> <span style="color:rgb(188,143,143);">1</span> <span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>

<span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">text</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Stiffness   :</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">10</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">60</span> <span style="color:rgb(188,143,143);">80</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">background</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">1</span> <span style="color:rgb(188,143,143);">1</span> <span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">ge_k</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">edit</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(50,185,185);">string</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">k</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">100</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">60</span> <span style="color:rgb(188,143,143);">80</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">text</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);"> N/m </span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">200</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">60</span> <span style="color:rgb(188,143,143);">30</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">background</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">1</span> <span style="color:rgb(188,143,143);">1</span> <span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>

<span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">pushbutton</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Calculate</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">10</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">85</span> <span style="color:rgb(188,143,143);">80</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">callback</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">calc</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>

<span style="color:rgb(0,0,0);">ge_r</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">text</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Result     :</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">10</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">110</span> <span style="color:rgb(188,143,143);">80</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">visible</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">off</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// keep these hidden for a start</span>
<span style="color:rgb(0,0,0);">ge_fs</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">text</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(50,185,185);">string</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">fres</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">100</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">110</span> <span style="color:rgb(188,143,143);">80</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">visible</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">off</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">ge_hz</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">text</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);"> Hz </span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">200</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">110</span> <span style="color:rgb(188,143,143);">30</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">visible</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">off</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>

<span style="color:rgb(50,185,185);">uicontrol</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">style</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">pushbutton</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">string</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Exit</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(255,170,0);">..</span>
          <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">position</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">10</span> <span style="color:rgb(0,0,0);">as</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">135</span> <span style="color:rgb(188,143,143);">80</span> <span style="color:rgb(188,143,143);">20</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">callback</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">goodbye</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span></pre>
          </div>
          <div class="moz-cite-prefix"><br>
          </div>
          <div class="moz-cite-prefix">On 29.11.2019 10:20, Antoine
            Monmayrant wrote:<br>
          </div>
          <blockquote type="cite"
            cite="mid:4ec6-5de0e300-f-5a85950@126498237">
            <pre class="moz-quote-pre" wrap="">Le Jeudi, Novembre 28, 2019 19:40 CET, Claus Futtrup <a class="moz-txt-link-rfc2396E" href="mailto:cfuttrup@gmail.com" moz-do-not-send="true"><cfuttrup@gmail.com></a> a écrit: 
 
</pre>
            <blockquote type="cite">
              <pre class="moz-quote-pre" wrap="">Hi Antoine

Also, you should better use get(a, 'propertyName') or set(a, 'propertyName', value) instead of a.propertyName and a.propertyName=value in your callbacks.


I see what you mean. I just now had trouble turning visibility on/off, 
but using set(), it works fine. Thanks for the tip.
</pre>
            </blockquote>
            <pre class="moz-quote-pre" wrap="">It's something quite weird, maybe a race condition.
I've seen it when using 'a.prop' or 'a.prop=value' syntax in either a callback function or in a for loop.
When you repeatedly use this syntax, scilab tends to forget that 'a' exists and that it's a handle with different properties.
The initial bug report is here: <a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/bugzilla.scilab.org/show_bug.cgi?id=15786" moz-do-not-send="true">http://bugzilla.scilab.org/show_bug.cgi?id=15786</a>
Not much progress because I never managed to get a minimal working example (it's an Heisenbug).

Antoine

</pre>
            <blockquote type="cite">
              <pre class="moz-quote-pre" wrap="">Best regards,
Claus

On 28.11.2019 17:47, Antoine Monmayrant wrote:
</pre>
              <blockquote type="cite">
                <pre class="moz-quote-pre" wrap="">Le Jeudi, Novembre 28, 2019 17:05 CET, Claus Futtrup <a class="moz-txt-link-rfc2396E" href="mailto:cfuttrup@gmail.com" moz-do-not-send="true"><cfuttrup@gmail.com></a> a écrit:
  
</pre>
                <blockquote type="cite">
                  <pre class="moz-quote-pre" wrap="">Hi Antoine, et al.

Your reply is very helpful, so I think you got the right question :-)

1) Good point that I can use callback on every uicontrol. This would be
suitable for a simple example (like gui_example.sce) ... but for heavy
calculations, it might be more practical with a CALC button. P.S. The
correct equation for the resonance frequency is fres=sqrt(k/m)/(2*%pi);
</pre>
                </blockquote>
                <pre class="moz-quote-pre" wrap="">You are right.
Also, the trick to disable the callback function/ reenable it is key for sliders that tend to generate an avalanche of call to the function when one moves the cursor.

</pre>
                <blockquote type="cite">
                  <pre class="moz-quote-pre" wrap="">2) I see what you mean, so not having an empty space, but "show" the
whole she-bang from the beginning. I didn't want to do that (just
deleting the IF-statement), but it could be the best solution in the end
(rather than the inline GUI updates), if nothing better shows up. This
was somehow the "core" of my question. Maybe I ask for too much.
</pre>
                </blockquote>
                <pre class="moz-quote-pre" wrap="">I think you can achieve what you want by setting ".visible='off'" for all the uicontrols you don't want to show initialy. You can then set  ".visible='on'" after the first call to the callback (or at each call if you are lazy).

</pre>
                <blockquote type="cite">
                  <pre class="moz-quote-pre" wrap="">3) I will look into this. Thanks for the tip.
</pre>
                </blockquote>
                <pre class="moz-quote-pre" wrap="">Also, you should better use get(a, 'propertyName') or set(a, 'propertyName', value) instead of a.propertyName and a.propertyName=value in your callbacks.
I have found that this latter syntax is causing a lot of bug if your callback get called really often. I still don't know why.

</pre>
                <blockquote type="cite">
                  <pre class="moz-quote-pre" wrap="">4) I will also look into this. My problem is the steep learning curve.
If you look at the Scilab tutorials you have the good-old Openeering
LHY_Tutorial - it's incredibly complicated and long. Is LHY_Tutorial
using the Model-Viewer-Controller approach? - Maybe the
Model-Viewer-Controller could be presented in a _simple_ tutorial - is
it possible?
</pre>
                </blockquote>
                <pre class="moz-quote-pre" wrap="">Hmm, that would be a good idea.
I'll see whether I can put something together.
The thing is, MVC approach looks rather silly and overengineered on a small example.

</pre>
                <blockquote type="cite">
                  <pre class="moz-quote-pre" wrap="">I appreciate gui_example.sce with just about 70 lines of code, two
inputs and one output. I think something like it could help a lot of
people ... and it's not 250 lines of code to get a GUI up and running,
if you know what I mean. The gui_example shows a few differences, like
white versus grey background, editable boxes, etc. In the outputs,
because of the default grey background, you can see the dimensions of
the grid / text-boxes, and gui_example has two buttons. It looks
operational and easy to expand for new users.

Cheers,
Claus

On 28.11.2019 08:57, Antoine Monmayrant wrote:
</pre>
                  <blockquote type="cite">
                    <pre class="moz-quote-pre" wrap="">Hello Claus,

I've been playing a bit with GUIs for teaching, so maybe I can help.
The issue is that I don't get what your problem is exactly here, so I my answer might be a bit off-topic.
Do not hesitate to rephrase your issue, I'll try a more focused answer.

Anywya, here is how I think your code could be improved:

(1) You can use 'calc' as the callback for all of the editable text field so that your result gets shown right away, without having to press a button.
(2) You should populate all the uicontrols of your gui first, then only update the displayed values, the visibility of the uicontrols, etc inside your calc function. (ie no more creating a uicontrol inside a callback)
(3) The 'tag' property of any uicontrol together with 'findobj()' are really nice to get/set the properties of each existing uicontrol.
(4) You can rely on a proper Model-View-Controler approach (or any other well established method to avoid mixing gui stuff with calculation stuff).

I attached a small gui I use to illustrate optical anti-reflection coating.
It is far from perfect (I did not implement a proper model-view-controler for example).
But you can see how I tried to separate the different parts of the code an how I use findobj/tag/get/set,  etc.

Hope it helps,

Antoine
   
Le Mercredi, Novembre 27, 2019 19:21 CET, Claus Futtrup <a class="moz-txt-link-rfc2396E" href="mailto:cfuttrup@gmail.com" moz-do-not-send="true"><cfuttrup@gmail.com></a> a écrit:
   
</pre>
                    <blockquote type="cite">
                      <pre class="moz-quote-pre" wrap="">Hi there

I'm trying to build a GUI. For simplicity on the forum, I've built a
really simple example of what I'm trying to do. How can I make the
"conditional" GUI output work and not have it inside the calc function?
... or, how would you do it? Thanks.

Best regards, Claus.

// GUI_EXAMPLE.SCE
//
// Demo of how to build a simple GUI in Scilab.
// Real simple, with two input variables and one output.
// The example uses the basic mechanical example of a mass and a spring as
// input parameters and calculates the resonance frequency of the mechanical
// system.

// Initialize variables
m  =  1;  // Moving mass 'm'(kilogram)
k  =  1;  // Stiffness, spring constant 'k'(Newton per meter)
fres  =  1;  // Resonance frequency (Hertz)
show_result  =  %f;

function  calc()
       m  =  evstr(get(ge_m,"string"));  // get content in uicontrol ge_m
       k  =  evstr(get(ge_k,"string"));  // get content in uicontrol ge_k
       fres  =  sqrt(m  *  k);
       // putting GUI updates inside the calculation routine is not pretty code.
       uicontrol("style","text","string","Result :","position",  ..
                 [10  as(2)-110  80  20]);
       uicontrol("style","text","string",string(fres),  ..
                 "position",[100  as(2)-110  80  20]);
       uicontrol("style","text","string","Hz ","position",  ..
                 [200  as(2)-110  30  20]);
       show_result  =  %t;
       // update global variables
       [m,k,fres,show_result]=return(m,k,fres,show_result);
endfunction

function  goodbye()
       close(ge);  // Close GUI window
       printf("Resulting fres: %f Hertz\n",fres);
       abort  // Print result in console (e.g. for copy/paste), then kill the app
endfunction

ge  =  scf();  // GUI Example, Initialize and 'set current figure'
as  =  ge.axes_size;  // read size of window, as = [width height]
ge.figure_name  =  "GUI Example";  // Change window header

uicontrol("style","text","string","Moving mass :","position",  ..
             [10  as(2)-35  80  20],"background",[1  1  1]);  // white background
             // position properties has four parameters = x,y,width,height
             // y-position counts from lower left corner, so we subtract from 'as'
ge_m  =  uicontrol("style","edit","string",string(m),  ..
             "position",[100  as(2)-35  80  20]);
uicontrol("style","text","string","kg ","position",  ..
             [200  as(2)-35  30  20],"background",[1  1  1]);

uicontrol("style","text","string","Stiffness :","position",  ..
             [10  as(2)-60  80  20],"background",[1  1  1]);
ge_k  =  uicontrol("style","edit","string",string(k),  ..
             "position",[100  as(2)-60  80  20]);
uicontrol("style","text","string","N/m ","position",  ..
             [200  as(2)-60  30  20],"background",[1  1  1]);

uicontrol("style","pushbutton","string","Calculate",  ..
             "position",[10  as(2)-85  80  20],"callback","calc");

// How do I make this "conditional"output show up in my GUI?
if  show_result  then  // If "Calculate"button was pushed at least once ...
       uicontrol("style","text","string","Result :","position",  ..
                 [10  as(2)-110  80  20]);
       uicontrol("style","text","string",string(fres),  ..
                 "position",[100  as(2)-110  80  20]);
       uicontrol("style","text","string","Hz ","position",  ..
                 [200  as(2)-110  30  20]);
end

uicontrol("style","pushbutton","string","Exit",  ..
             "position",[10  as(2)-135  80  20],"callback","goodbye");


_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
                    </blockquote>
                  </blockquote>
                </blockquote>
                <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
              </blockquote>
              <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>

</pre>
            </blockquote>
            <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
          </blockquote>
          <p><br>
          </p>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
</pre>
        </blockquote>
        <pre class="moz-signature" cols="72">-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/www.utc.fr/~mottelet" moz-do-not-send="true">http://www.utc.fr/~mottelet</a>
</pre>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
      </blockquote>
      <p><br>
      </p>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a class="moz-txt-link-freetext" href="http://www.utc.fr/~mottelet">http://www.utc.fr/~mottelet</a>
</pre>
  </body>
</html>