Board index FlightGear Development Canvas

[SOLVED] Canvas and properties

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

[SOLVED] Canvas and properties

Postby clm76 » Tue Aug 09, 2016 7:24 am

Hi,

As i'm learning Canvas and trying to replace an old MFD display by a new canvas MFD, what is the best way to display the values of properties such as "instrumentation/airspeed-indicator/true-speed-kt" ? Setlistener, maketimer or others ?
Last edited by clm76 on Wed Aug 10, 2016 6:48 am, edited 1 time in total.
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: Canvas and properties

Postby Thorsten » Tue Aug 09, 2016 8:03 am

A display update loop at a reasonable rate would be the tool of choice. This would then read all displayed properties during an update cycle, display them, wait till the next cycle and repeat.

Note that if you display a property at framerate, it might be difficult to read if it changes rapidly.
Thorsten
 
Posts: 11191
Joined: Mon Nov 02, 2009 8:33 am

Re: Canvas and properties

Postby Alant » Tue Aug 09, 2016 9:11 am

I assume that you have tried the property browser.

The property browser shift-click facility http://wiki.flightgear.org/Property_bro ... and_tricks is often useful.

Alan
Alant
 
Posts: 916
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Canvas and properties

Postby Hooray » Tue Aug 09, 2016 5:01 pm

The most efficient method would be using a simple helper-framework like the one Thorsten mentioned (e.g. using Richard's MFD work), but preparing it to be replaced/augmented through native hooks eventually - i.e. it would be relatively simple to hack the Canvas:Element code to also support property values, i.e. values retrieved from other properties - that would minimize the degree of required Nasal code rather significantly, especially in conjunction with supporting sprintf-style format strings - but that would require some c++ changes, for the corresponding background info, see:

viewtopic.php?f=71&p=266721#p266721
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

Re: Canvas and properties

Postby clm76 » Wed Aug 10, 2016 6:47 am

Thanks for your advice.

For my canvas MFD, I used a display update loop as said Thorsten and it works well.
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: [SOLVED] Canvas and properties

Postby Hooray » Wed Aug 10, 2016 4:13 pm

If in doubt, check out Richard's MFD framework
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

Re: [SOLVED] Canvas and properties

Postby clm76 » Thu Aug 11, 2016 7:12 am

If in doubt, check out Richard's MFD framework

Ok. Where can I find it ?
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: [SOLVED] Canvas and properties

Postby Richard » Thu Aug 11, 2016 7:34 am

clm76 wrote in Thu Aug 11, 2016 7:12 am:
If in doubt, check out Richard's MFD framework

Ok. Where can I find it ?

It's been in FGData for a while now. http://wiki.flightgear.org/Canvas_MFD_Framework

A working example can be found on the Shuttle and on the F-15

Thorsten recently pointed out that the buttons can only currently change page; this will hopefully be fixed for .3 but I can't promise this
Richard
 
Posts: 726
Joined: Sun Nov 02, 2014 10:17 pm
Version: Git
OS: Win10

Re: [SOLVED] Canvas and properties

Postby clm76 » Thu Aug 11, 2016 5:30 pm

Thanks, that gives me some ideas ...
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3


Return to Canvas

Who is online

Users browsing this forum: No registered users and 2 guests