by joedarock » Mon Oct 10, 2016 3:26 pm
The same problem exists for a Group control, so I'll use that as an example.
The following example app was created in CrossUI RAD Studio 1.3 by placing just a group control on the page and writing an alert in the event code:
Class('App', 'xui.Com',{
// Ensure that all the value of "key/value pair" does not refer to external variables
Instance:{
// To determine whether or not the com will be destroyed, when the first UI control be destroyed
autoDestroy : true,
// To initialize properties
properties : {},
// To initialize instance(e.g. properties)
initialize : function(){
},
// To initialize internal components (mostly UI controls)
// *** If you're not a skilled, dont modify this function manually ***
iniComponents : function(){
// [[Code created by CrossUI RAD Studio
var host=this, children=[], append=function(child){children.push(child.get(0));};
append(
(new xui.UI.Group())
.setHost(host,"ctl_group169")
.setLeft(230)
.setTop(120)
.setWidth(190)
.setHeight(180)
.setCaption("ctl_group169")
.setToggleBtn(false)
.beforeHoverEffect("_ctl_group169_beforehovereffect")
);
return children;
// ]]Code created by CrossUI RAD Studio
},
// Give a chance to determine which UI controls will be appended to parent container
customAppend : function(parent, subId, left, top){
// "return false" will cause all the internal UI controls will be added to the parent panel
return false;
},
// Give a chance to load other resource
iniResource: function(com, threadid){
//xui.Thread.suspend(threadid);
//var callback=function(/**/){
// /**/
// xui.Thread.resume(threadid);
//};
},
// Give a chance to load other com
iniExComs : function(com, threadid){
//xui.Thread.suspend(threadid);
//var callback=function(/**/){
// /**/
// xui.Thread.resume(threadid);
//};
},
_ctl_group169_beforehovereffect:function (profile, item, e, src, type){
var ns = this, uictrl = profile.boxing();
alert("Hover");
}
}
});
This code doesn't fire the event.
I then wrote the same app in SPA Builder On-line:
// The default code is a module class (inherited from xui.Module)
// Ensure that all the value of "key/value pair" does not refer to external variables
Class('App', 'xui.Module',{
Instance:{
// Dependency classes
Dependencies:[],
// Required modules
Required:[],
// To initialize properties
properties : {},
// To initialize instance(e.g. properties)
initialize : function(){
},
// To initialize internal components (mostly UI controls)
// *** If you're not a skilled, dont modify this function manually ***
iniComponents : function(){
// [[Code created by CrossUI RAD Studio
var host=this, children=[], append=function(child){children.push(child.get(0));};
append(
xui.create("xui.UI.Group")
.setHost(host,"xui_ui_group1")
.setLeft(230)
.setTop(180)
.setWidth(200)
.setHeight(100)
.setCaption("xui_ui_group1")
.setToggleBtn(false)
.beforeHoverEffect("_xui_ui_group1_beforehovereffect")
);
return children;
// ]]Code created by CrossUI RAD Studio
},
// Give a chance to determine which UI controls will be appended to parent container
customAppend : function(parent, subId, left, top){
// "return false" will cause all the internal UI controls will be added to the parent panel
return false;
},
_xui_ui_group1_beforehovereffect:function (profile,item,e,src,type){
var ns = this, uictrl = profile.boxing();
alert("Hover");
}
/*,
// To determine how properties affects this module
propSetAction : function(prop){
},
// To set all node's style in this modlue
customStyle:{}
},
//To customize the default properties and event handlers
Static:{
$DataModel:{
},
$EventHandlers:{
}
*/
}
});
This works. I haven't looked at the differences, but it does appear to be version dependent. In Ver 1.4, no events are fired at all. In the on-line version, events are fired for every item in the control (it seems).
As you know, I tried upgrading to Ver 1.4 a while ago with catastrophic consequences. so I'm still on 1.3 until my confidence level is restored. I'd try to build my application code on the on-line compiler, but the app is built in about 6 files, so I haven't figured out how to do that.