Board index FlightGear Development

GUI: Is it possible to format a property value ?  Topic is solved

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

GUI: Is it possible to format a property value ?

Postby mhab » Wed Nov 06, 2013 11:42 pm

Hello

I want to define a GUI-dialog in XML way and I want to display a property e.g. the fuel-level as a text.
Is there a way to format the property-value e.g. in order to cut all but 1 decimal place ?

Code: Select all
      <text>
        <row>2</row>
        <col>2</col>
        <property>/consumables/fuel/tank/level-lbs</property>
        <halign>right</halign>
        <live>true</live>
      </text>


Thanks
Mike-DE
mhab
 
Posts: 410
Joined: Thu Apr 18, 2013 10:59 pm
Callsign: D-MIKE
Version: 2019.1.1
OS: Win10

Re: GUI: Is it possible to format a property value ?  

Postby Philosopher » Thu Nov 07, 2013 12:05 am

Yeah, add a <format> tag with contents like:

%.1f

(look up printf/sprintf formatting for more)
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: GUI: Is it possible to format a property value ?

Postby Hooray » Mon Nov 11, 2013 5:20 pm

Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11376
Joined: Tue Mar 25, 2008 8:40 am


Return to Development

Who is online

Users browsing this forum: No registered users and 2 guests