February 18, 200521 yr I need some help with using " Case " statements in XML. I can find plenty of code that is used for displaying bitmap images, like Sample 1. I have not been able to use "Case statements" for any other purpose. I would like to know if it can be used to display "TEXT", like Sample 2. and can it also be used to display "Parameters" like Sample 3 ? greenco**************************************************************Sample 1(A:Flaps handle index,number) *****************************************************************Sample 2(A:Flaps handle index,number)Flaps UpFlaps NeutralFlaps Down ***************************************************************** Sample 3(A:Number of Engines, number)%((A:RECIP ENG1 FUEL FLOW, pounds per hour))%!5.2f!%((A:RECIP ENG2 FUEL FLOW, pounds per hour))%!5.2f!%((A:RECIP ENG3 FUEL FLOW, pounds per hour))%!5.2f!
February 18, 200521 yr Hi ???,Two examples from my gauges:To display a string with a case:%('FULL' '20' '10' 'UP' 4 (A:FLAPS HANDLE INDEX,number) case )%!s! To use a case in a clickspot tooltip:GPWS State (%('Off' 'Temporarily Suspended' 'On' 'Test' ' ' 5 (G:Var1) case )%!s!)Cheers, Rob Barendregt
February 18, 200521 yr With your knowledge Rob ...I could rule the world! :-lolregardsEdhttp://forums.avsim.net/user_files/106762.jpg My FS Videos
February 18, 200521 yr Thanks, but that is not what I was after. Is it possible to do something like this? This code is just an example and it does nothing, other than to demostrate what I want to do. I want to get a value (a number) from a parameter and depending upon what that number is, I want to display the contents of another parameter, in a gauge.(A:Number of Engines, number)%((A:RECIP ENG1 FUEL FLOW, pounds perhour))%!5.2f!%((A:RECIP ENG2 FUEL FLOW, pounds perhour))%!5.2f!%((A:RECIP ENG3 FUEL FLOW, pounds perhour))%!5.2f!greenco
February 18, 200521 yr According to the DTD, and your and my experience, the tag only works for images.The expression parser does have a case operator, as shown in Rob's sample, and there is a different {case} structure that can be used inside s. I'd use that one in your case; there's some examples in the beech_baron. I'd whip up an example, but I'd get it wrong, so I'll leave that to the experts here.Douglas
February 18, 200521 yr There are two ways to display s dependant on some parameter. The first would be to write 4 nearly identical containing the full formats controlled by .. Too much writing. The second way follows. Controlled by (L:EngineDisplay, number).. 0=off, 1= ENG1, 2=ENG2, etc.. %((L:EngineDisplay, number))%{case}%{:1}%((A:RECIP ENG1 FUEL FLOW, pounds per hour))%!5.2f!%{:2}%((A:RECIP ENG2 FUEL FLOW, pounds per hour))%!5.2f!%{:3}%((A:RECIP ENG3 FUEL FLOW, pounds per hour))%!5.2f!%{:4}%((A:RECIP ENG4 FUEL FLOW, pounds per hour))%!5.2f!%{end}%Robs post shows how to change "fixed" items ( The above could work too ) donot know if his version would switch between variables, haven't tried.Regards,Roman(KGRB) FS RTWR SHRS F-111 JoinFS Little Navmap
February 18, 200521 yr Thanks RomanI can use your code to make it do what I was wanting. I gather that your code is another method to get around writing a lot of IF..ELSE statements. I have filed it away in my XML folder, for future use.Thanks againgreenco
Create an account or sign in to comment