XML: Refreshing Panels in FS9 & FSX

From FSDeveloper Wiki
Jump to: navigation, search

Unlike FSX, FS9 does not offer the possibility to assign a key combination for refreshin an aircraft's panel in the UI. Therefor, one has to resort to one of three methods to avoid reloading the whole aircraft every time a gauge or its placement properties are changed.


Method 1: A clickable button on the panel

Similar to the default SimIcons, this small button forces a refresh of the panel (panel.cfg and all gauges used by it). It can be downloaded here and can be placed whereever desired.

Method 2: Reload by fs9.cfg and keystroke

Add this under "[KEYBOARD_MAIN]" to the FS9.cfg:

 RELOAD_PANELS=121,11



This should make CTRL+SHIFT+F10 reload the panel.

'Beware:' There might be a chance that this key assignment will be deleted if you change something from FS9's UI and FS9 saves the changes to the .cfg file!

Method 3: Reload by gauge and keystroke

While method #2 above offers universal way to assign a keystroke combination to force a gauge refresh, this can also be achieved on a per-aicraft basis by means of a custom gauge.

Create a new gauge in the aircraft's "panel folder" and name it, e.g. "Reload_Panel.xml". Then copy&paste in the following code into the xml:


 <?xml version="1.0" encoding="UTF-8"?>
 <Gauge Name="Reload Panel" Version="1.0">
 <Keys>
 <On Key="889">
   (>K:RELOAD_PANELS)
   </On>
  </Keys>
 </Gauge>


Finally, alias the gauge to the panel by putting the following line into [Window00] or [VCockpit01] sections.

 gaugeXX=Reload_Panel,1,1,1,1


Make sure to keep the gauge in sequence with the already existant ones!
This places a 1-by-1 pixel sized gauge at position 1,1 on the main panel or in the VC.

References for key codes and further applications for controlling custom gauge variables by key can be found here and here.

FS9 vs FSX

In FSX, the Event "RELOAD_USER_AIRCRAFT" must be used in place of "RELOAD_PANELS" which works only in FS9.

A general XML Refresh gauge can be written as:

<Gauge Name="Panel Reload" Version="1.0" >
 <Image Name="Reload.bmp" Bright="Yes" ImageSizes="20,20,0,0"/>
 <Mouse>
  <Area Left="0" Top="0" Width="20" Height="20">
  <Cursor Type="Hand"/>
   <Click>
    (A:Fuel weight per gallon, pounds per gallon) 0 ==
       if{ (>K:RELOAD_USER_AIRCRAFT) } // FSX
      els{ (>K:RELOAD_PANELS) }        // FS9
   </Click>
  </Area>
 </Mouse>
</Gauge>

where Reload.bmp is a 20x20 pixel icon that can be clicked to initiate a panel refresh.

Note that the variable (A:Fuel weight per gallon, pounds per gallon) returns 6 in FS9 but 0 in FSX. Thus, it can be used to distinguish between the two sims.