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 » Thu Nov 07, 2013 12:42 am

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: 418
Joined: Thu Apr 18, 2013 11:59 pm
Callsign: D-MIKE
Version: 2020.3.4
OS: Win10

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

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

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

%.1f

(look up printf/sprintf formatting for more)
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

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

Postby Hooray » Mon Nov 11, 2013 6: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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Development

Who is online

Users browsing this forum: No registered users and 9 guests