Sign in to follow this  
Varmint007

XML 3 way wafer switch code

Recommended Posts

Hi Guys. I've been hacking at this code all day. From reading lots of prior posts, I came up with the following code. It is meant to display a wafer switch with 3 options (GPS,Nav1,Nav2). When you click on either of the three click regions, it changes the bitmap to represent which of the three regions you clicked on. Simultaneously, it will write either 0,1,2 to the Linked Variable L:NavMode, which I will use later in other gauges.Right now when I click on the bitmap regions, nothing happens in changing the bitmap, and I suspect in updating the variable. Any ideas? I've read the forum a great deal without any answers. Thanks. Cylon(>L:NavMode, enum)0 (%gt, L:NavMode, enum)1 (%gt, L:NavMode, enum)2 (%gt, L:NavMode, enum)

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi,Did you try:0 (>L:NavMode, enum)etc.?You used &gt, instead of >Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

(>L:NavMode, enum)0 (>L:NavMode, enum)1 (>L:NavMode, enum)2 (>L:NavMode, enum)From the above code, I did attempt to change the assignment using ">" instead of "%gt". I got %gt from another post I saw on this forum. The above code didn't work though. It's still not cycling through the bitmaps depending on which hotspot I click.BTW, I'm not entirely sure how everything works in this implementation of XML. I've done C, C++, and lots of VB programming and it seems like there's alot of unexplained stuff. For example, what is the "enum" data type? From my previous experience, I know that certain functions require certain datatypes. But I have no idea what datatypes are returned by certain functions. For example, what range does the RPM variable return? Are they integers only? Also, I'm not sure how the RPN functions deal with the various datatypes. Are the math operators overloaded to handle all datatypes? Sorry for the long post, but I'm really confused on how to do simple things in XML.Cylon

Share this post


Link to post
Share on other sites

Hi,In the "Value Section" you use:(>L:NavMode, enum)That must be:(L:NavMode, enum)Btw. Watch the "spaces" between arguments:Must be: In 2004 you don't need ImageSizes="64,65,0,0" anymore, doesn't work.Bitmaps need the correct dimensions in relation to each other.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Thanks for your help Jan. I got it working. For others to see... here's the code that made it work.(L:NavMode, enum) 0 ==(L:NavMode, enum) 1 ==(L:NavMode, enum) 2 ==%((L:NavMode, enum))%!1d! 0 (>L:NavMode, enum) 1 (>L:NavMode, enum) 2 (>L:NavMode, enum)

Share this post


Link to post
Share on other sites

I know this is an old post, but I'm having a similar problem with my project.What I'm trying to do is assign values to TWO variables within one click event, like so: 1 (>G:Var1, number) 2 (>G:Var2, number) I then want to use the second variable for this:(G:Var2, number) 2 (>G:Var1, number) Can a select/case clause not be nested in a click event?Also, I'm finding it extremely difficult to figure out how to assign a value to initialize a variable. It's always got to be conditional, and I can't find any examples. How would I go about simply putting a value into a variable -- one time -- when the gauge loads?Thanks much in advance, and pls somebody respond as I'm at my wit's end!Jon

Share this post


Link to post
Share on other sites

Hi,Try to use only:(G:Var1) and (>G:Var1) etc. no arguments.eg:(G:Var1) 0 == if{ 1 (>G:Var1) } els{ 0 (>G:Var1) }or (G:Var2) ! (>G:Var2) You can have as many events in the click section as you want.To show "18" somewhere (?) make an element:(G:Var1) 1 ==......18For a value:(G:Var1) 1 == if{ 1 (G:Var2) } els{ 0 (G:Var2) }or:(G:Var2) 18 > if{ 1 (>G:Var1) }To load a condition in a variable take a L:Var or (G:Var)eg:(A:Indicated Altitude,feet) (>G:Var1)or(A:Indicated Airspeed,knots) (>L:Speed,number)Or something.Hope it helps Jan"Procul Negotiis"

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