XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 Nov 23日 03:14

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 2017年 Sep 5日 06:31 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 572
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.


Last edited by yereverluvinuncleber on 2017年 Sep 6日 00:19, edited 1 time in total.

Top
 Profile  
 
PostPosted: 2017年 Sep 5日 08:12 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 572
Jim, please feel free to test but I suspect you'd rather not. Just take my word for it that this is a bug and enter it into the list please.

Basically, indenting some code should not stop it being recognised.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group