Board index FlightGear Development Nasal

Dialog question

Nasal is the scripting language of FlightGear.

Dialog question

Postby gkick » Tue Jun 18, 2019 1:58 am

Hi,

What is the best approach to display a combo listing available runways for a preselected airport input box to avoid entering a non existing runway nos.
The airport prompt updates the airport.teleport(airport = to reposition the aircraft aloft some distance etc approaching the nominated airport and runway.

The position aircraft in air dialog has no combo, the airports dialog has one coupled to a radio button. There must be a shorter way for a simple dialog
like look up runways for airport, put those numbers into an array (think its called a hash or a vector in Nasal) and use the array to fill the combo
and after update set the corresponding runway prompt for the airport.teleport function.

Anyone has come across an example of something similar?

Thanks
gkick
 
Posts: 106
Joined: Sun Jan 01, 2017 11:04 pm

Re: Dialog question

Postby clm76 » Tue Jun 25, 2019 6:20 am

Hi,

Is something like this you want ?

Image
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: Dialog question

Postby gkick » Tue Jun 25, 2019 6:45 pm

Hi,

thank you for your response. No what I need is a droplist to select a runway like in the route manager dialog

merci
gkick
 
Posts: 106
Joined: Sun Jan 01, 2017 11:04 pm

Re: Dialog question

Postby Hooray » Tue Jun 25, 2019 7:07 pm

You can simply use a Canvas ScrollArea (vertical), add the corresponding elements to it (e.g. buttons, labels, images) and then hook up event handlers to each element. That takes roughly 20 lines of code. You can refer to the original "Aircraft Center" in $FG_ROOT/Nasal/canvas: http://wiki.flightgear.org/Aircraft_Center

Image

or simply see the canvas snippets wiki article: http://wiki.flightgear.org/Canvas_Snippets

http://wiki.flightgear.org/Howto:Proces ... ist_widget

Image

Image

The same approach can be used to create a simple property-browser approximation (it's just a foreach loop that ends up calling iself recursively to traverse/dump the current property branch and register event handlers for each entry):
Image

Finally, once you have something that works, you can also create a new dedicated widget, see:

http://wiki.flightgear.org/Canvas_Widgets
http://wiki.flightgear.org/Canvas_Widget_Matrix
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: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: Dialog question

Postby gkick » Tue Jun 25, 2019 9:55 pm

Thank you, will get cracking!
gkick
 
Posts: 106
Joined: Sun Jan 01, 2017 11:04 pm


Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest