Board index FlightGear Development

How to really refesh a dialog built by nasal

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

How to really refesh a dialog built by nasal

Postby mhab » Tue May 03, 2016 9:41 pm

Hello

I am working to improve the "AI/Traffic and Scenario Settings" dialog (scenario.xml) in a way so different types of scenarios can be filtered via a combo element.
The dialog displays checkboxes, one for each scenario. All these checkboxes are generated by nasal code from within the <nasal><open> ... </open></nasal> tag.
So after I figured out how to filter the scenarios I end up with one remaining problem.

If I change the filter so that more entries (checkboxes) appear I get the dialog refreshed by closing/opening it.

Problem: If the filter results in less than the currently displayed checkboxes, the closing/opening doesn't work well, as the unwanted checkboxes still remain.
If I reload the GUI then everything is refreshed as wanted.

Question: Is there a way to "really/completely" refresh the whole dialog in the way "reload GUI" does it ?

Thanks
Mike-DE
mhab
 
Posts: 418
Joined: Thu Apr 18, 2013 11:59 pm
Callsign: D-MIKE
Version: 2020.3.4
OS: Win10

Re: How to really refesh a dialog built by nasal

Postby mhab » Wed May 04, 2016 9:41 am

Hello

I found a way to refresh the dialog completely.
What I do in the bindings of the related widgets is the following:
Code: Select all
      <binding>
        <command>nasal</command>
        <script>
         ...
          var args = {'subsystem':'gui'};
          fgcommand("reinit",args);
        </script>
      </binding>

This is what's behind "reload GUI".

Mike-DE
mhab
 
Posts: 418
Joined: Thu Apr 18, 2013 11:59 pm
Callsign: D-MIKE
Version: 2020.3.4
OS: Win10

Re: How to really refesh a dialog built by nasal

Postby Hooray » Wed May 04, 2016 12:14 pm

$FG_ROOT/Docs/README.commands and README.gui, see menubar.xml for other examples.
Note that "list dialogs" (multiplayer, pilot-list and performance monitor) often still end up closing/re-creating the dialog

Feel free to add this to the wiki if you think it's not sufficiently documented.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Development

Who is online

Users browsing this forum: No registered users and 4 guests