Code: Select all
var AutopilotApplication = {
timerAPDialog: 0,
btnWinglevel: nil,
btnRollhold: nil,
btnHeadingBug: nil,
btnTrueHeading: nil,
btnNav1Course: nil,
btnSpeedKIAS: nil,
btnSpeedMach: nil,
btnThrottle: nil,
btnPitch: nil,
btnVerticalSpeed: nil,
btnPitchHold: nil,
btnAoAHold: nil,
btnAltHold: nil,
txtAltHold: nil,
btnAGLHold: nil,
...
You can see I defined txtAltHold
later in a method called "init"
comes
Code: Select all
txtAltHold = canvas.gui.widgets.LineEdit.new(me.root, canvas.style, {})
.setText("0")
.setFixedSize(50, 25);
me.hboxAltitude = canvas.HBoxLayout.new();
me.hboxAltitude.addItem(txtAltHold);
me.hboxAltitude5.addItem(me.hboxAltitude);
it obviously works because when I bring the dialog up, the field shows. Now, here begins the drama. I can't find any event type, I can listen to for a lineEdit-widget. So I have to poll it. I set me a timer and ...
Code: Select all
update: func() {
print("update apdialog");
setprop("/autopilot/settings/standby-altitude-ft", txtAltHold.getText());
if (me.timerAPDialog==1) {
settimer(me.update, 1);
}
}
I get the printed message, then boom ... Nasal runtime error: undefined symbol: txtAltHold
at /home/peter/flightgear/fgdevelopment/Aircraft/JPack/Voodoomaster/Dialogs/autopilot9_1.nas, line 1002
I tried also instead me.txtAltHold ... then it says "me" is undefined.
any idea what's wrong? Help is appreciated, I am total rusty after months of absence.