Jump to content
Sign in to follow this  
jonny

Select value case

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 :-)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Not "almost impossible." It is impossible!


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...