Board index FlightGear Development Nasal

Faking enter key press

Nasal is the scripting language of FlightGear.

Faking enter key press

Postby gkick » Sun Jun 09, 2019 4:53 pm

Hi All,

how to simulate a keypress ??

The code below is executed by way of a button anywhere up in the clouds.

Code: Select all
         setprop("/sim/atc/freq-airport", (getprop("/sim/airport/closest-airport-id")));   
         fgcommand("dialog-show",{ "dialog-name" : "atc-freq-search" }));         

sets the property correct and opens the freq search form.
Now is there a way to simulate that the enter key was pressed to close the dialog to open the results dialog
or is there a way to open the results directly without showing the search dialog.???
Last edited by Johan G on Mon Jun 10, 2019 7:33 am, edited 1 time in total.
Reason: Added [code] tags. They can be added manually or with the [^_ ] button.
Posts: 106
Joined: Sun Jan 01, 2017 11:04 pm

Re: Faking enter key press

Postby Gijs » Thu Jun 13, 2019 9:46 am


This should open the results dialog with the frequencies of the closest airport:
Code: Select all
fgcommand("ATC-freq-display",{ "icao" : getprop("/sim/airport/closest-airport-id") }) );
fgcommand("dialog-show",{ "dialog-name" : "atc-freq-display" }) );

Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Posts: 9353
Joined: Tue Jul 03, 2007 2:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Faking enter key press

Postby Octal450 » Thu Jun 13, 2019 3:59 pm

You can also use the <command>dialog-close</command> binding to close the current dialog. Just make sure you do that after you open the other one.

What I do: Flight Dynamics, Systems, Canvas Displays, Autoflight, FlyByWire, Cockpit Animations
Aircraft I currently develop: MD-11 (Mainly), Secret, A320-family (Quality over Quantity)

My GitHub|MD-11 and ITAF Dev Discord|Airbus Dev Discord
User avatar
Posts: 4742
Joined: Tue Oct 06, 2015 12:51 pm
Callsign: WTF411/Octal
Version: next
OS: Windows 7/10 x64

Re: Faking enter key press

Postby gkick » Thu Jun 13, 2019 5:30 pm

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

Return to Nasal

Who is online

Users browsing this forum: BLEXBot [Bot] and 1 guest