Jump to content

Archived

This topic is now archived and is closed to further replies.

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!

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 New...