Board index FlightGear Development Nasal

problems with gui.FileSelector

Nasal is the scripting language of FlightGear.

problems with gui.FileSelector

Postby Alant » Mon Nov 13, 2017 11:30 pm

I am trying to read an Xml file containing a flightplan, but get this error when the my nasal files are being loaded at start-up.

Nasal runtime error: No such member: FILE_DIALOG_OPEN_FILE
at C:/Flightgear/fgdata/Nasal/gui.nas, line 530
called from: C:/Flightgear/MyAircraft/TSR2/Dialogs/TSR2-route-manager-dlg.nas, line 25

Line 25 of this file is :-
var load_route = gui.FileSelector.new(import_plan, "Import Flightplan", "Import");

I can find no definition for FILE_DIALOG_OPEN_FILE

Any ideas please?

Alan
Alant
 
Posts: 1219
Joined: Wed Jun 23, 2010 6:58 am
Location: Portugal
Callsign: Tarnish99
Version: latest Git
OS: Windows 10/11

Re: problems with gui.FileSelector

Postby wkitty42 » Tue Nov 14, 2017 1:24 am

either read the code or ask on the developers' mailing list would be my first instinct... the mailing list can result in answers to some questions much faster than the forums... depending on the day and time, amongst other factors...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: problems with gui.FileSelector

Postby Alant » Tue Nov 14, 2017 1:40 am

Yes, the first thing that I did was to read the code in fgdata/gui and Flightgear.

Next I did a search through fgaddon.and the rest of fgdata

I found no matches.for FILE_DIALOG_OPEN_FILE other than this at line 530 of fgdata/Nasal/gui.nas
var usage = gui.FILE_DIALOG_OPEN_FILE;

So where is FILE_DIALOG_OPEN_FILE defined ?

Alan
Alant
 
Posts: 1219
Joined: Wed Jun 23, 2010 6:58 am
Location: Portugal
Callsign: Tarnish99
Version: latest Git
OS: Windows 10/11

Re: problems with gui.FileSelector

Postby wkitty42 » Tue Nov 14, 2017 1:51 am

i think you missed looking in the actual C/C++ source code files?

i might be getting lucky... i dunno... i used grep and happened to start in my FG src directory instead of one of the others...

Code: Select all
myuser@mymachine:~/flightgear-dev/next/flightgear/src$ egrep -r -e "FILE_DIALOG_OPEN_FILE" *
GUI/FileDialog.cxx:    guiModule.set("FILE_DIALOG_OPEN_FILE", (int) FGFileDialog::USE_OPEN_FILE);


i did not find anything more in any of the simgear, openscenegraph or plib source code directories...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: problems with gui.FileSelector

Postby Alant » Tue Nov 14, 2017 10:35 am

Thanks - it is there.
My search ln the source last night must have gone wrong. (too much red wine perhaps?)

Now I have to work out why my nasal call did not pick it up.

Alan
Alant
 
Posts: 1219
Joined: Wed Jun 23, 2010 6:58 am
Location: Portugal
Callsign: Tarnish99
Version: latest Git
OS: Windows 10/11

Re: problems with gui.FileSelector

Postby Alant » Tue Nov 14, 2017 11:06 pm

This evening I re-arranged and tidyed up my code, but made no obvious changes and it is now working.

It remains a mystery as to why it failed last night.

Alan

PS I can´t mark this as solved as today´s and yesterday´s code, as far as I can see, functionally the same.

Thanks for the help.
Alant
 
Posts: 1219
Joined: Wed Jun 23, 2010 6:58 am
Location: Portugal
Callsign: Tarnish99
Version: latest Git
OS: Windows 10/11


Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest