Board index FlightGear Development Nasal

Changing the value of a PUI input field dynamically  Topic is solved

Nasal is the scripting language of FlightGear.

Changing the value of a PUI input field dynamically

Postby wlbragg » Wed Feb 05, 2020 12:17 am

Is there a way to update a PUI "input" field dynamically without resorting to something like

Code: Select all
fgcommand("dialog-close", props.Node.new({"dialog-name": "aicargo-dialog"}));
fgcommand("dialog-show", props.Node.new({"dialog-name": "aicargo-dialog"}));


A text box is updated without any special call just by changing that property value...
Code: Select all
      <text>
        <halign>left</halign>
        <property>/sim/gui/dialogs/cargo/weight</property>
        <live>true</live>
      </text>


Why not an input field? The input field is defined like this. Changing the value of the property changed the value of the input field but only on a open and closes command.

Code: Select all
        <input>
          <name>weight</name>
          <pref-width>60</pref-width>
          <halign>fill</halign>
          <stretch>true</stretch>
          <property>/sim/gui/dialogs/cargo/weight</property>
          <binding>
            <command>dialog-apply</command>
            <object-name>weight</object-name>
          </binding>
        </input>

        <input>
          <name>height</name>
          <pref-width>60</pref-width>
          <halign>fill</halign>
          <stretch>true</stretch>
          <property>/sim/gui/dialogs/cargo/height</property>
          <binding>
            <command>dialog-apply</command>
            <object-name>height</object-name>
          </binding>
        </input>
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Changing the value of a PUI input field dynamically

Postby WoodSTokk » Wed Feb 05, 2020 3:54 am

Code: Select all
<live>true</live>

works also in input objects.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: Changing the value of a PUI input field dynamically  

Postby wlbragg » Wed Feb 05, 2020 5:27 am

Outstanding, so that is what that is for. Thank you!
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070


Return to Nasal

Who is online

Users browsing this forum: No registered users and 7 guests