Last week it was starting to work , but this week it crashes flightgear when I close the dialogue window. Usually my work is saved every evening on my git server, but for the last month that has been out of service since I lost my landline in the massive fires here in central Portugal.
In an attempt to find the problem I have stripped the code back to the minimum, and now it has just the code attached at the end of this post, but FG still crashes. The My debug print message (route-manager Window.del done) is displayed, but that is the last entry both log and console.
The nasal file is loaded with this in my set.xml file:
- Code: Select all
<dialogs>
<file>Aircraft/TSR2/Nasal/TSR2-dialogs.nas</file>
<file>Aircraft/TSR2/Dialogs/TSR2-route-manager-dlg.nas</file>
</dialogs>
and called with this line in TSR2-dialogs.nas:
- Code: Select all
gui.menuBind("route-manager","dialogs.Route_Manager_Dialog.new().show()");
TSR2-route-manager-dlg.nas:-
- Code: Select all
var Route_Manager_Dialog = {
_width: 580,
_height: 400,
new: func (title="Route_Manager") {
var m = {
parents: [Route_Manager_Dialog]
};
m._title = title;
print ("Route Manager Dialog");
return m;
},
show: func {
# create a new window, dimensions are WIDTH x HEIGHT, using the dialog decoration (i.e. titlebar)
var window = canvas.Window.new([me._width, me._height], "Route_Manager");
window.set("title", me._title);
window.owner = me;
# add a canvas to the new window and setting up background colors/transparency
var myCanvas = window.createCanvas().set("background", canvas.style.getColor("bg_color"));
# create the top-level/root group which will contain all other elements/group
var root = myCanvas.createGroup();
# create a new layout for the waypoints:
me.myVBox = canvas.VBoxLayout.new();
# set up new horizontal boxes
me.buttons = canvas.HBoxLayout.new();
me.myVBox.addItem(me.buttons);
# assign the layout to the Canvas
myCanvas.setLayout(me.myVBox);
me.load_button = canvas.gui.widgets.Button.new(root, canvas.style, {});
me.load_button.setText("Load Flightplan");
me.load_button.setFixedSize(100, 30);
me.buttons.addItem(me.load_button);
me.load_button.listen("clicked",func {
load_route();
});
me.save_button = canvas.gui.widgets.Button.new(root, canvas.style, {});
me.save_button.setText("Save FlightPlan");
me.save_button.setFixedSize(100, 30);
me.buttons.addItem(me.save_button);
me.save_button.listen("clicked",func {
save_route();
});
# This gets called when the dialog is closed
window.del = func {
call(canvas.Window.del, [], me);
print ("route-manager Window.del done");
}
}
};
var load_route = func {
print("load button clicked");
}
var save_route = func {
print("save button clicked");
}
Any ideas please?
Alan