I have a custom dialog which allows to override wind-settings of both basic and advanced weather, so that one can set arbitary wind headings and speeds
without interpolation up to 10k for practicing takeoffs and landings in head, tail, cross or other wind scenarios.
The screen dump image https://www.dropbox.com/s/pq8lxl37o5gmm ... s.JPG?dl=0 shows three dialogs,
The Set Wind Conditions on the right works fine if the Weather dialog on the left has the radio button on Basic Weather and a check in manual config.
Since I do not know what the default start weather might be, I use the middle dialog Windconfig to switch to Basic Weather and place a check into manual config.
If basic weather is already active the code below just places the check and everything is fine.
- Code: Select all
<binding>
<command>nasal</command>
<script>
fgcommand("dialog-show", props.Node.new({ "dialog-name" : "weather" }));
setprop( "/environment/params/metar-updates-environment", 0 );
setprop( "/environment/realwx/enabled", 0 ); setprop( "/environment/config/enabled", 1 );
setprop("/nasal/manual_weather/enabled", "true");
setprop("/nasal/local_weather/enabled", "false");
setprop( "/sim/gui/dialogs/metar/mode/global-weather", "1" );
setprop( "/sim/gui/dialogs/metar/mode/local-weather", "0" );
setprop( "/sim/gui/dialogs/metar/mode/manual-weather", "1" );
gui.dialog_update("weather");
gui.dialog_apply("weather");
setprop("/devices/status/keyboard/event/key[10]/pressed",1);
fgcommand("dialog-close", props.Node.new({ "dialog-name" : "weather" }));
fgcommand("dialog-close", props.Node.new({ "dialog-name" : "windconfig" }));
setprop("/systems/mws",1);
</script>
</binding>
If the advanced weather is active the code moves the radio button to basic and also places the check and updates relevant properties in
sim/gui/dialogs/metar/mode/global-weather
However the Set Wind dialog will not work because something is missing. If I click the OK or the Apply button in the Weather dialog it does work because the buttons run some functions in the background like update and or refresh
As I go in circles figuring out whats missing I thought of fakeing the ok button press by using the line
setprop("/devices/status/keyboard/event/key[10]/pressed",1);
but that does not produce the desired result nor triggers an error.
The first line of the code opens the weather dialog since the properties of the metar dialog do not exist in the property tree beforehand but can be manipulated after. So the general idea is to only show the Set Wind dialog running the relevant config in the background. Hope the explanation makes some sense
Any ideas will be much appreciated.
Thanks