Sign in to follow this  
G.Franco Corrias

Next Waypoint Distance

Recommended Posts

Hi,- - - %((A:GPS WP Distance,nMiles) 0 max 9999.9 min)%!3d!- - GPS_WP_DISTANCE,NMilesThis is a "Next waypoint Distance" gauge I'm working actually.Problems are:1)At the panel opening appears only 0. I would like 00.0 and always numbers have to be shown by 2 figures plus a decimal one.2)if I put as unit "nMiles" the value will be rounded to the nearest mile value.If I put as unit "DecinMiles" the value appears ,I think it's right, showing the total decinMiles.Example: If I load a flight plan where the first waypoint distance is 41.9NM if the unit in the gauge is "NMiles" I'll have shown on the panel 42(value rounded to the nearest one),if the unit is "decinMiles" on the panel appears 419.How can I manage to have on the panel as value 41.9 and always three figures as written above?Thanks in advanceG.Franco

Share this post


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

I'm posting a correction of my previous post.At the panel opening and always I would like four digits:000.0 not as I wrote wrongly only three.Sorry for the new message but the time was expired.Regards G.Franco

Share this post


Link to post
Share on other sites

Hi,Try:%((A:GPS WP Distance,Nmiles))%!3.1f! Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hi,If you actually need leading zeroes, like "043.2", I will dare to amend Jan's line :-) because I think "f" doesn't support that.So, if you really need the leading 0's, and !3.1f! doesn't work, just try (not tested)%((A:GPS WP Distance,Nmiles) s0 int)%!03d!.%(l0 1 %)%!d! Tom

Share this post


Link to post
Share on other sites

hi Tom,thanks for the help.I tryied your string and now the leading zeros appear but the decimal is missing.The right expected distance to be shown is 041.9 with your string appears only 041 Looking at Microsoft SDK I found an example to have the altimeters showing thousand of feet: it's suggested to divide by 1000.Don't you think that using as unit "DecinMiles" and dividing by 10 it should be a good idea?I tryied it but the gauge stops working maybe I made an other error.Regards G.Franco

Share this post


Link to post
Share on other sites

Hi Gianfranco,THis is the correct line:%((A:GPS WP Distance,Nmiles) s0 int)%!03d!.%(l0 1 % 10 * int)%!d! Mind the "." after the "!03d!" and before the "%" that indicates the decimal point's position.Also watch the longitude of the because if it is too short, the value won't show complete. Tom

Share this post


Link to post
Share on other sites

Hi Tom,an other step has been made.Now the distance value appears 000.0 but the decimal is stuck to zero.Decimal shows always zero.Thanks again G.Franco

Share this post


Link to post
Share on other sites

As Tom has mentioned, "leading zeros" will not be added to any floating point format specification. From Susan Ashlock's blog* (Lead Gauge Programmer at ACES) :%( 12.34 )%!04.3f!12.340 (Leading

Share this post


Link to post
Share on other sites

Hi,I have DME with leading 0's and decimals (eg: 003.2) using rolling numbers.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

hi to all,now the gauge works properly!My error was due to lower case L.I typed "|" instead of "l" and this was the reason why the decimal was stuck to zero.I'm a beginner and for this issue I do have to consider how difficult is to make gauges.Thanks to all of you for the help and lesson.Regards G.Franco

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