Sign in to follow this  
Guest Karl R Pettersen

Xml, external macro calls,strings, and formatted text

Recommended Posts

HiAbout the macros call, or call to another gauge/dll. How does this really work? Is it possible to call an xml macro located in another gauge? That would have been extremely helpful, with a separate gauge containing loads of subfunctions the other gauges require. I tried some last night, but was unsuccessful.Has anyone found out how to store a custom string to an (L:Variable,string), then print it out again? I've tried both direct and preformatted, but I just can't get it to work.As for formatted text, which I'm really starting to fall in love with, I seem to fail formatting with leading zeroes in a float. Is it broken, or am I broken? :) Also, are there any numerical/decimal tabs available?

Share this post


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

I've found no special formatting for numberical data (believe me, I've tried). You can do things like special case tabs using the format /{tabs=xxR,xxC,xxL} /{tabs=} which overide the default formatted text tabs. Aditionally you can define secondary colors and fonts. For example if you wanted to have some number turn red if it's below 0, you could do so by first defining the secondary color and then using the special case {clrX} tags.{clr2}%This text will by Cyan{clr}{clr1}%This text will be red{clr}nFor tabs, you can do this:{tabs=50R,60,145,244R}tColumns1tColumns2tColumns3{tabs=}That may help you special case numerical formatting within the same text block.Hope that helps,--Jon

Share this post


Link to post
Share on other sites

Oh, I forgot to address strings and macros:Macros cannot be made global, but since they are not technically variables and probably consume insignificant amounts of memory, just copy them from gauge to gauge using some master XML document to make all changes to. As you probably know, you can pass them multiple arguments which makes them extremely useful as functions, and they also make very fine constants.Strings are a complete mystery to me, and Microsoft isn't making it any easier. The lastest SDK has shed no light on the subject, or for that matter, any other XML specific information. In fact they're so difficult to get working, I've just resorted to using enums and macro defined constants with the {case} construct.By the way, have you got any idea why this doesn't work:Pseudo:...Or this:...It's driving me NUTS! It only accepts a number - period. No variable and certainly not an expresson.--Jon

Share this post


Link to post
Share on other sites

Hi Karl,.....leading zeroes in a float.....Put the digit Zero in front of the format specification.So:With 06.2f the value 8.123 is printed as: 008.12orWith 06d the value 123 is printed as 000123Now, with negative numbers you're in trouble :-)With 06.2f: -8.123 becomes 0-8.12-0.10 becomes 00-.10-23.12 becames -23.12Same for 06d:- 123 becomes 00-123I.o.w: the last leading 0 is subtituded by the - sign, not the first.A very clumsy bug.Rob

Share this post


Link to post
Share on other sites

Only tried with floats, but 06.2f seems to work for me only in "regular" text elements, not formattedtext. Maybe there was another bug there somewhere (_very_ complex string display with nested cases and ifs - yuck).In any case, I worked around it by using tabs instead. Heh, never noticed that negative number bug, but I guess could be worked by concatenating a string, doing a negative check and print out the sign before an absolute version of the number was printed.The only number I have been able to pass half a function to, is using the ? word to select between two colors in a text element - that's it :( I'm quite annoyed that I can't do it with anything else, because it would have eased doesn on programming *a lot*! I use(d) rather heavy macros on many gauges - fixing every one of them for each modification proved such a hazzle I put them all into a single gauge now (calculations and initialization stuff). I really hoped to avoid it though, the gauge looks like a mess :)

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