Philosopher wrote in Wed Jul 10, 2013 1:46 pm:expecially with the window decorations
var dlg = canvas.Window.new([400,300], "dialog");
Philosopher wrote in Wed Jul 10, 2013 1:46 pm: I find configuring pixel positions rather time-consuming .
Philosopher wrote in Wed Jul 10, 2013 2:31 pm:I just make up numbers until it fits .
Philosopher wrote in Wed Jul 10, 2013 2:31 pm:Actually a good "development extension" would be one that shows the position in pixels when you click on a Canvas -- so I could just say "I want my text *here* [click]"
my_canvas.addEventListener("click", func(e) globals.gui.popupTip(sprintf("click (%.1f|%.1f)", e.clientX, e.clientY)));
TheTom wrote in Wed Jul 10, 2013 3:04 pm:Philosopher wrote in Wed Jul 10, 2013 2:31 pm:Actually a good "development extension" would be one that shows the position in pixels when you click on a Canvas -- so I could just say "I want my text *here* [click]"
- Code: Select all
my_canvas.addEventListener("click", func(e) globals.gui.popupTip(sprintf("click (%.1f|%.1f)", e.clientX, e.clientY)));
###################################################################################
# Variables
###################################################################################
var radioButtonRate = 0.2; # Controls rate of adjustment
var apButtonRate = 0.2; # Controls rate of adjustment
var tapVS = 0; # Used to control Tap/Hold for AP VS
var tapIAS = 0; # Used to control Tap/Hold for AP IAS
# Needs to be on, as most times the object being adjusted is not visible.
var enablePopUps = 1;
###################################################################################
# Initialisation
###################################################################################
var initJoystickNasal = func {
setprop("/autopilot/settings/heading-bug-deg", 0); # Sometines is undefined
################################################################################
# Radio adjust busy flags
################################################################################
# Initialise property-tree. These are used to slow down radio frequency adjusting
props.globals.getNode("/busyNAV1", 1);
setprop("/busyNAV1", 0);
props.globals.getNode("/busyNAV2", 1);
setprop("/busyNAV2", 0);
props.globals.getNode("/busyADF1", 1);
setprop("/busyADF1", 0);
props.globals.getNode("/busyADF2", 1);
setprop("/busyADF2", 0);
# When a busy flag is set, clears it after radioButtonRate seconds.
# Sets rate of change
setlistener("/busyNAV1", func { if (getprop("/busyNAV1")) settimer(busyNAV1Clear, radioButtonRate, 1); });
setlistener("/busyNAV2", func { if (getprop("/busyNAV2")) settimer(busyNAV2Clear, radioButtonRate, 1); });
setlistener("/busyADF1", func { if (getprop("/busyADF1")) settimer(busyADF1Clear, radioButtonRate, 1); });
setlistener("/busyADF2", func { if (getprop("/busyADF2")) settimer(busyADF2Clear, radioButtonRate, 1); });
################################################################################
# IAS and VS busy flags
################################################################################
# Used to implement tap/hold button function.
# Tap the button and AP IAS set to current IAS or AP VS set to current VS.
# Hold button, AP IAS adjust up/down or AP VS adjust uip/down.
props.globals.getNode("/busyVS", 1);
setprop("/busyVS", 0);
props.globals.getNode("/busyIAS", 1);
setprop("/busyIAS", 0);
# When a busy flags is set, clears it after apButtonRate seconds.
# Sets rate of value change.
setlistener("/busyVS", func { if (getprop("/busyVS")) settimer(busyVSClear, apButtonRate, 1); });
setlistener("/busyIAS", func { if (getprop("/busyIAS")) settimer(busyIASClear, apButtonRate, 1); });
}
# These are the routines for clearing the busy flags.
var busyNAV1Clear = func {
setprop("/busyNAV1", 0);
}
var busyNAV2Clear = func {
setprop("/busyNAV2", 0);
}
var busyADF1Clear = func {
setprop("/busyADF1", 0);
}
var busyADF2Clear = func {
setprop("/busyADF2", 0);
}
var busyVSClear = func {
setprop("/busyVS", 0);
}
var busyIASClear = func {
setprop("/busyIAS", 0);
}
# Library routines will start here
RADIO FUNCTIONS
Adjust the Standby frequency of a radio
Adjust upwards in small steps
NAV1 Up Small, NAV2 Up Small, etc.
Adjust the upwards in large steps
NAV1 Up Large, COM2 Up Large, etc.
Adjust downwards in small steps
NAV1 Down Small, ADF2 Down Small, etc.
Adjust downwards in large steps
NAV1 Down Large, NAV2 Down Large, etc.
Swap the Selected and Standby frequencies (Transfer)
Swap NAV1, Swap NAV2, Swap ADF1, etc.
NAVIGATION FUNCTIONS
Set the radials for the radios
Adjust clockwise in small steps
NAV1 Right Small, NAV2 Right Small, etc.
Adjust clockwise in large steps
NAV1 Right Large, ADF1 Right Large, etc.
Adjust anti-clockwise in small steps
NAV1 Left Small, ADF2 Left Small, etc.
Adjust anti-clockwise in large steps
NAV1 Left Large, NAV2 Left Large, etc.
Heading bug
Adjust clockwise
HdgBug Right
Adjust anti-clockwise
HdgBug Left
Select NAV1 or NAV2 to DME display
NAV1 to DME, NAV2 to DME
AUTOPILOT FUNCTIONS
Toggle AP On/Off
AP Toggle
but look at how the select-a-button works right now:
you can't copy controls.nas: what happens when it gets overridden with aircraft-specifics
Philosopher wrote in Fri Jul 12, 2013 3:02 am:@TheTom: Where can I find your Canvas demo that had selectable text, tabs, and scrolling ? You made a video of it on the wiki.
Users browsing this forum: No registered users and 6 guests