XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 7th, 2025, 10:59 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: January 30th, 2018, 10:49 am 
Offline
User avatar

Joined: July 29th, 2013, 9:13 am
Posts: 609
An object event such as a dragdrop onto an image can be assigned Functions using the IDE that results in the following stub code:

Code:
function tapOnDragDrop(Sender,Data,Point)
{

}


and an entry in main.xul that actually associates the image event with the function:

Code:
<image name="tap"  onDragDrop="tapOnDragDrop"/>


Unfortunately, Xwidget does not allow you to associate a function to an object using code, it has to be done via the IDE. This sort of dynamic function assignment is not possible in Xwidget because the engine ignores any standard function definitions in code:

The following is a standard method of assigning a function in code using all variants of javascript.

Code:
lightTap.onMouseDown = function() {
.
.
.
}


In one of my programs I have a long bit of code duplicating twelve button images that could be concatenated to one function like this:

Code:
 if (playListText.length > 0) {
      for (var i in playListText) {
          (function(i) {
                 playListText[i].onDragDrop = function (event) {
                     dropPosition = i;
                     catchFileDrop(event, null);
                 }
          })(parseFloat(i));  //protect this value by setting it as value of a numeric variable in an immediately-called function
        }
 }


This code is perfectly valid javascript, it works in MS jscript upon which Xwidgets is based. It is just because xwidgets hijacks function definitions and insists they must be done manually through the IDE in order to be valid, that it no longer operates.

This code works in a browser and in the yahoo widget engine. Not in Xwidget.

The developer Tony should look at changing his engine to allow standard definitions in code. It can be done, it has been done. It is sad that Xwidgets is crippled in this way as it means standard javascript cannot be migrated to Xwidgets easily. It also results in kludgy code.



PS. Jim, add this please to the list of bugs.


Top
 Profile  
 
PostPosted: February 17th, 2018, 1:30 am 
Offline
User avatar

Joined: July 29th, 2013, 9:13 am
Posts: 609
Doing things the Xwidget way forces all object events and definitions into the main.xul file. This is an old-fashioned and very primitive way of defining objects and events.

The much more sensible thing would be to allow the same events to be defined in code. Done this way any widget code becomes much more transportable from one engine to another.

The yahoo widget engine defines all such events in the .KON file, the equivalent to Xwidget's main.xul file. The main advantage is that it also allows the same objects and events to be defined in code as does javascript for the web.

Code:
lightTap.onMouseDown = function() {
.
.
.
}


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: Google [Bot] and 26 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