Board index FlightGear Development Canvas

Basic canvas questions

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.

Basic canvas questions

Postby wlbragg » Thu Sep 23, 2021 9:56 pm

I feel so inept at canvas programming because I don't even know the basics.

I see code where windows are cleaned up using something like.

call(canvas.Window.del, [], me);

If a dialog canvas window is closed with its own button on the title bar, is this necessary?

How do you catch a dialog close event when it is closed by the button on the title bar?

I want to completely reset any data associated with a canvas widow on close of that window but don't know how to catch the closing?

I've also noticed my dialog window close (or default X) button is slightly clipped at the bottom the white background of the main window. What would cause that?
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7586
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Basic canvas questions

Postby Thorsten » Fri Sep 24, 2021 7:17 am

If a dialog canvas window is closed with its own button on the title bar, is this necessary?


Not as such, but it is necessary to re-define the close function when you have a dialog which has its own loop running in the background, because that's your only possibility of catching the dialog closing and terminating the loop. Otherwise you close the visuals, but the background logic just struggles on and gets duplicated once you open the dialog again.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Basic canvas questions

Postby wlbragg » Fri Sep 24, 2021 9:13 am

Ah, ok, that explains it. Thanks!
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7586
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070


Return to Canvas

Who is online

Users browsing this forum: No registered users and 7 guests