[I'm not happy about it, but the gauge I'm modifying is in FSX AceXML format.]
[Here's the code that should produce the display I want. I don't know if it works, because my key variable (NavSourceSel) never gets changed from 0. In it's previous life, this code worked to toggle between GPS and NAV1 driving navigation.]
<Element id="CRS/DTK/wp/distance Readout">
<FloatPosition>20.000,194.000</FloatPosition>
<GaugeText id="CRS Readout">
<Bold>False</Bold>
<Bright>True</Bright>
<FontFace>Arial</FontFace>
<FontColor>cyan</FontColor>
<FontHeight>11</FontHeight>
<GaugeString> %((A:GPS DRIVES NAV1, bool)) //GPS is driving navigation
%{if}
\{clr2}
%((A:GPS is active way point, bool))%{if}%((A:GPS WP DESIRED TRACK, degrees))%!03d!%{else}----%{end} DTK\n
GPS\n
%((A:GPS is active way point, bool))%{if}%((A:GPS WP NEXT ID, string))%!s!%{else}----%{end}\n
%((A:GPS is active way point, bool))%{if}%((A:GPS WP DISTANCE, nmiles) s1 0 >=)%{if}%(l1 100 >=)%{if}%(l1)%!d!%{else}%(l1)%!
0.1f!%{end}%{else}----%{end}%{else}----%{end}% NM
\{clr}
%{else}
%((L:NavSourceSel,number) 1 ==)%{if} // NAV1 is driving navigation
%((A:NAV1 OBS,degrees) near)%!03d! CRS\n
VOR 1\n
%((A:NAV1 has nav, bool))%{if}%((A:NAV1 ident, string))%!s!%{else}----%{end}\n
%((A:NAV1 DME, nmiles) s1 0 >=)%{if}%(l1 100 >=)%{if}%(l1)%!d!%{else}%(l1)%!0.1f!%{end}%{else}----%{end}% NM
%{end}
%{else}
%((L:NavSourceSel,number) 2 ==)%{if} // NAV2 is driving navigation
%((A:NAV2 OBS,degrees) near)%!03d! CRS\n
VOR 2\n
%((A:NAV2 has nav, bool))%{if}%((A:NAV2 ident, string))%!s!%{else}----%{end}\n
%((A:NAV2 DME, nmiles) s1 0 >=)%{if}%(l1 100 >=)%{if}%(l1)%!d!%{else}%(l1)%!0.1f!%{end}%{else}----%{end}% NM
%{end}
</GaugeString>
<Size>50,60</Size>
<Transparent>True</Transparent>
<AlternateColor id="AlternateColor">
<FontColor>Magenta</FontColor>
</AlternateColor>
</GaugeText>
</Element>
[Here is a very simple function I added -- clicking an on-screen knob toggles the display of VOR2 information (controlled by the VOR2w variable).]
[I included this code here only to show a successful left mouse click routine.]
<MouseArea id="VOR2 Knob">
<FloatPosition>15.000,346.000</FloatPosition>
<Size>25,25</Size>
<CursorType>Hand</CursorType>
<MouseClick id="MouseClick">
<Script>
(L:VOR2w,bool) ! (>L:VOR2w,bool)
</Script>
</MouseClick>
<Tooltip><DefaultScript>VOR2 Info Switch</DefaultScript></Tooltip>
</MouseArea>
[Here's the mouse click that doesn't work. When this on-screen button is pressed, nothing happens.]
<MouseArea id="NAV/GPS">
<FloatPosition>48,336</FloatPosition>
<Size>45,21</Size>
<HelpId>HELPID_GAUGE_NAV_GPS_SWITCH</HelpId>
<CursorType>Hand</CursorType>
<MouseClick id="MouseClick">
<Script>
(L:NavSourceSel,number)
%{case}
%{:0}1 (>L:NavSourceSel,number) // follow NAV1
<KeyEvent>TOGGLE_GPS_DRIVES_NAV1</KeyEvent>
1 (>K:AP_NAV_SELECT_SET)
%{:1}2 (>L:NavSourceSel,number) // follow NAV2
2 (>K:AP_NAV_SELECT_SET)
%{:2}0 (>L:NavSourceSel,number) // follow GPS
<KeyEvent>TOGGLE_GPS_DRIVES_NAV1</KeyEvent>
%{end}
</Script>
</MouseClick>
</MouseArea>