Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Select value case

Featured Replies

Hi,I have this code in a gauge:...<Element> <Position X="8" Y="8"/> <Select> <Value>(L:Valt, number)</Value> <Case Value="0"> <Image Name="none.bmp"/> </Case> <Case Value="1"> <Image Name="nav1.bmp"/> </Case> <Case Value="2"> <Text X="42" Y="12" Bright="Yes" Length="5" Font="Arial" Color="#00FF00" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No"> <String>NAV 2</String> </Text> </Case> </Select> </Element>...Value 0 and 1 show up the bmp file OK,but for value 2 I get nothing!What is wrong in my code or is it impossible to use Text-String in a Case block?/Jonny

I'm not really an expert, but I can't a font size for Case 2.

Gerry Howard

Hi,If this is for FSX:I haven't tried it, but try to enclose the whole Select structure into an additional Element.FSX seems to be very picky on the syntax of Element nesting, and I have a few examples of my xml gauges that worked fine in FS9, but had to add another Element structure because a bitmap or textstring wouldn't show up in FSX.Example:

<Element>   <Visible>    (A:SPOILERS LEFT POSITION,percent) 10 >  </Visible>  <Position X="52" Y="24"/>   <Text X="47" Y="12" Length="10" Font="arial bold" FontSize="12" Color="#FF0000" Adjust="Left">    <String>AIRBRK</String>   </Text> </Element> 

works fine in FS9, but not in FSX (won't display the string AIRBRK)If I change it to

<Element>   <Visible>    (A:SPOILERS LEFT POSITION,percent) 10 >  </Visible>  <Element>    <Position X="52" Y="24"/>     <Text X="47" Y="12" Length="10" Font="arial bold" FontSize="12" Color="#FF0000" Adjust="Left">      <String>AIRBRK</String>     </Text>   </Element> </Element> 

it works fine in FSX.RobPS: Next time, use the "Insert code snippet" function to insert XML code into a post; makes it a lot more readable :-)

  • Author

Thank's for the answers so far.My code is for FS9.I do think my problem has to do with the <Case>..</Case> block. When I have an <Image..> in the block all works fine. But when I try to write a text in the gauge nothing happend. I try to find somthing about this in tutorials on the net and in MS SDK but I can't find any detailed manual.Anyone with a good hint!!??/jonny

Thank's for the answers so far.My code is for FS9.I do think my problem has to do with the <Case>..</Case> block. When I have an <Image..> in the block all works fine. But when I try to write a text in the gauge nothing happend. I try to find somthing about this in tutorials on the net and in MS SDK but I can't find any detailed manual.Anyone with a good hint!!??/jonny
Have you actually set the font height? Using the ACES tool for FSX, the the string doesn't display unless FontHeight is set to a non-zero-value.

Gerry Howard

Thank's for the answers so far.My code is for FS9.I do think my problem has to do with the <Case>..</Case> block. When I have an <Image..> in the block all works fine. But when I try to write a text in the gauge nothing happend. I try to find somthing about this in tutorials on the net and in MS SDK but I can't find any detailed manual.Anyone with a good hint!!??/jonny
Hello there!You are using the wrong sintax, the sintax for "case" statements using text elements is different from the one using image elements. So if you want to use a text string you have to change your sintax to something like:<String>%((L:Var, number))%{case}%{:0}%Text0%{:1}%Text1%{:2}%Text2%{end}%</String>I haven't done it but I think you can mix bmp's using this sintax, you may like to search in the forum :).Javier
  • Author
Hello there!You are using the wrong sintax, the sintax for "case" statements using text elements is different from the one using image elements. So if you want to use a text string you have to change your sintax to something like:<String>%((L:Var, number))%{case}%{:0}%Text0%{:1}%Text1%{:2}%Text2%{end}%</String>I haven't done it but I think you can mix bmp's using this sintax, you may like to search in the forum :).Javier
Hi Javier!And thank's very much, the code works perfect and I am very happy!Sorry, it is almost impossible to find a good manual for XML-gauge syntax./Jonny
  • Moderator

Not "almost impossible." It is impossible!

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Try this, Rob B is right, I had to nest text elements in a few gauges so they would work.

  <Element>    <Position X="8" Y="8" />    <Select>      <Value>(L:Valt, number)</Value>      <Case Value="0">        <Image Name="none.bmp" />      </Case>      <Case Value="1">        <Image Name="nav1.bmp" />      </Case>    </Select>    <Element>      <Position X="8" Y="8" />      <Visible>(L:Valt, number) 2 == </Visible>      <Text X="42" Y="12" Bright="Yes" Length="5" Font="Arial" Color="#00FF00" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">        <String>NAV 2</String>      </Text>    </Element>  </Element>

I have plenty of text gauges without Font size being declared. They self adjust to the x, y, length descriptors...Don

Try this, Rob B is right, I had to nest text elements in a few gauges so they would work.
  <Element>    <Position X="8" Y="8" />    <Select>      <Value>(L:Valt, number)</Value>      <Case Value="0">        <Image Name="none.bmp" />      </Case>      <Case Value="1">        <Image Name="nav1.bmp" />      </Case>    </Select>    <Element>      <Position X="8" Y="8" />      <Visible>(L:Valt, number) 2 == </Visible>      <Text X="42" Y="12" Bright="Yes" Length="5" Font="Arial" Color="#00FF00" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">        <String>NAV 2</String>      </Text>    </Element>  </Element>

I have plenty of text gauges without Font size being declared. They self adjust to the x, y, length descriptors...Don

Hi!Or just separate the elements, not need to nested them, the </Visible> tag does the trick. I haven't try it but using the text string alternative the code would be like this:<String>%((L:Var, number))%{case}%{:0}%\{img1}%{:1}%\{img2}%{:2}%Text2%{end}%</String>But before you got to define the images to be used with <Image Name="Image.bmp" etc...</Image> in the text element you are using there is not need to use the </Case> tag again for the images definitions.Javier

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.