Functions can exist within other functions within javascript. Code is typically structured so that it is 'tabbed' or indented to show its relationship to the parent function. This is perfectly valid in normal code and the indentation helps to show the function is solely operative within the context of the parent function. However, in Xwidget some functions are not recognised as being valid when indented or tabbed in code.
It specifically applies to Xwidget's own functions, note the following function is tabbed to the right and has 5 spaces prior to the function declaration.:
Code:
function BottomHelpOnMouseDown(Sender,Button,Shift,X,Y)
{
if (preferencesSoundPref.text === "enable") {
playSound(pageFumble);
}
TopHelp.opacity = 0;
BottomHelp.opacity = 0;
};
These non-standard Xwidget function definitions (those created automatically with the Xwidget IDE, typically identified with the extra Sender,Button,Shift,X,Y variable information passed to the function), the function declaration must be at column position 1 for the IDE to know the function exists and to recognise it in your program. If they are indented the engine does not recognise them.
The effect of this bug is that if you have tabbed or indented onEvent functions based solely within other functions, after you convert your standard javascript code to Xwidget these type of functions may no longer be accessible. You will have to untab them and restore their position to column 1.
However, do note this does not apply to standard jscript functions as shown here:
Code:
function getListing(path) {
pathString = getFileList(path,validTypes,false);
// convert to array
var paths = pathString.split('|');
for(var i = 0; i < paths.length; i++)
.
.
.
}
The above indented function is valid for both jscript and Xwidgets, only the indented Xwidget function is not recognised. That is the bug that needs to be fixed.