About new version

Develop and Deploy Native Apps for Windows, OS X, Linux, Unix ...

About new version

Postby wahono77 » Thu Nov 28, 2013 6:50 am

In old version of CrossUI, I use some code and OK. But in current version I got trouble. I create file dialog for nodejs and and phonegap.

javascript code
// The default code is a com class (inherited from xui.Com)
Class('App', 'xui.Com',{
// Ensure that all the value of "key/value pair" does not refer to external variables
Instance:{
// To initialize instance(e.g. properties)
initialize : function(){
// To determine whether or not the com will be destroyed, when the first UI control be destroyed
SPA = this;
this.autoDestroy = true;
// To initialize properties
this.properties = {};
},
// 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 Tools
var host=this, children=[], append=function(child){children.push(child.get(0));};

append((new xui.UI.TreeGrid())
.setHost(host,"ctl_treegrid611")
.setRowNumbered(true)
.setHeader([{"id":"filename", "width":300, "type":"helpinput", "editable":true, "caption":"Filename", "editorProperties":{"commandBtn":"pop"}, "editorEvents":{"onCommand":SPA._ctl_slideplaylist_oncommand}, "editorListItems":[{"id":"default1", "caption":"Default 1"}, {"id":"default2", "caption":"Default 2"}, {"id":"default3", "caption":"Default 3"}, {"id":"default4", "caption":"Default 4"}, {"id":"default5", "caption":"Default 5"}]}, {"id":"description", "width":700, "type":"input", "editable":true, "caption":"Deskripsi"}])
.setRows([{"cells":[{"value":"img/1.png", "id":"c_a"}, {"value":"Contoh slide 1", "id":"c_b"}], "id":"ac"}, {"cells":[{"value":"img/2.png", "id":"c_c"}, {"value":"Contoh slide 2", "id":"c_d"}], "id":"ad"}, {"cells":[{"value":"img/3.png", "id":"c_e"}, {"value":"Contoh slide 3", "id":"c_f"}], "id":"ae"}, {"cells":[{"value":"img/4.png", "id":"c_g"}, {"value":"Contoh slide 4", "id":"c_h"}], "id":"af"}, {"cells":[{"value":"img/5.png", "id":"c_i"}, {"value":"Contoh slide 5", "id":"c_j"}], "id":"ag"}, {"cells":[{"value":"img/6.png", "id":"c_k"}, {"value":"Contoh slide 6", "id":"c_l"}], "id":"ah"}, {"cells":[{"value":"img/7.png", "id":"c_m"}, {"value":"Contoh slide 7", "id":"c_n"}], "id":"ai"}])
);

return children;
// ]]Code created by CrossUI RAD Tools
},
// Give a chance to load other com
iniExComs : function(com, threadid){
},
// 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;
},
// This instance's events
events : {"onReady":"_com_onready"},
_ctl_slideplaylist_oncommand: function (profile,src){
var ns = this, uictrl = profile.boxing();
xui.ComFactory.getCom("App.filedialog",function() {
this.ShowDialog(function (asrc) {
uictrl.setUIValue(asrc,true);
}, function () {
});
});
},
_com_onready:function (com,threadid){

}
}
});


And the dialog :

javascript code
// The default code is a com class (inherited from xui.Com)
Class('App.filedialog', 'xui.Com',{
// Ensure that all the value of "key/value pair" does not refer to external variables
Instance:{
// To initialize instance(e.g. properties)
initialize : function(){
// To determine whether or not the com will be destroyed, when the first UI control be destroyed
SPA_FILEDLG = this;
this.autoDestroy = false;
// To initialize properties
this.properties = {};
},
// 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 Tools
var host=this, children=[], append=function(child){children.push(child.get(0));};

append((new xui.UI.Dialog())
.setHost(host,"ctl_dialog")
.setDock("fill")
.setInitPos("auto")
.setOverflow("")
.setCaption("Open File")
.setMovable(false)
.setMinBtn(false)
.setMaxBtn(false)
.setCloseBtn(false)
.setMinWidth(600)
.setMinHeight(800)
.setStatus("max")
);

host.ctl_dialog.append((new xui.UI.ToolBar())
.setHost(host,"ctl_toolbar1")
.setItems([{"id":"grp1", "sub":[{"id":"up", "caption":"Naik"}, {"id":"hidden", "caption":"Show hidden", "statusButton":true}], "caption":"grp1"}, {"id":"grp2", "sub":[{"id":"refresh", "caption":"Refresh"}], "caption":"grp2"}])
.onClick("_ctl_toolbar18_onclick")
);

host.ctl_dialog.append((new xui.UI.Button())
.setHost(host,"ctl_save")
.setWidth(130)
.setHeight(30)
.setRight(160)
.setBottom(5)
.setCaption("OK")
.setImage("{/}img/ok.png")
.onClick("_ctl_save_onclick")
);

host.ctl_dialog.append((new xui.UI.Button())
.setHost(host,"ctl_close")
.setWidth(130)
.setHeight(30)
.setRight(20)
.setBottom(5)
.setCaption("Tutup")
.setImage("{/}img/cancel.png")
.onClick("_ctl_close_onclick")
);

host.ctl_dialog.append((new xui.UI.Input())
.setHost(host,"ctl_filename")
.setLeft(0)
.setWidth("auto")
.setHeight(30)
.setRight(350)
.setBottom(5)
);

host.ctl_dialog.append((new xui.UI.Input())
.setHost(host,"ctl_input624")
.setLeft(60)
.setTop(120)
.setWidth(310)
.setLabelSize(100)
.setLabelCaption("Test value")
.setValue("testfilename")
);

return children;
// ]]Code created by CrossUI RAD Tools
},
// Give a chance to load other com
iniExComs : function(com, threadid){
},
// 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;
},
ShowDialog : function(onYes, onNo){
this._onYes = onYes;
this._onNo = onNo;
this.ctl_dialog.show();
},
// This instance's events
events : {"onReady":"_com_onready"},
_com_onready : function (com,threadid){
},
_ctl_toolbar18_onclick : function (profile,item,group,e,src){
var ns = this, uictrl = profile.boxing();
},
_ctl_filelist_onitemselected : function (profile,item,e,src,type){
var ns = this, uictrl = profile.boxing();
},
_ctl_save_onclick : function (profile,e,src,value){
var ns = this, uictrl = profile.boxing();
ns._onYes(ns.ctl_input624.getUIValue());
ns.ctl_dialog.hide();
},
_ctl_close_onclick : function (profile,e,src,value){
var ns = this, uictrl = profile.boxing();
ns._onNo();
ns.ctl_dialog.hide();
},
_onYes : function (asrc){

},
_onNo : function (){
}
}
});


If I click command button from grid, I show the dialog, and after choose a file (testfilename in this sample), and clik OK button, the cell grid should fill by testfilename.

The problem is in code :
xui.ComFactory.getCom("App.filedialog",function() {
this.ShowDialog(function (asrc) {
uictrl.setUIValue(asrc,true); =======>uictrl doesn't work
}, function () {
});
});

Thanks
wahono77
 
Posts: 90
Joined: Sat Apr 13, 2013 6:04 am

Re: About new version

Postby support » Thu Nov 28, 2013 11:14 am

I tested the following code, it works well. Can you give me more detail?
   
Class('App', 'xui.Com',{
Instance:{
initialize : function(){
SPA = this;
},
iniComponents : function(){
// [[Code created by CrossUI RAD Tools
var host=this, children=[], append=function(child){children.push(child.get(0));};

append((new xui.UI.TreeGrid())
.setHost(host,"ctl_treegrid611")
.setRowNumbered(true)
.setHeader([{"id":"filename", "width":300, "type":"helpinput", "editable":true, "caption":"Filename", "editorProperties":{"commandBtn":"pop"}, "editorEvents":{"onCommand":SPA._ctl_slideplaylist_oncommand}, "editorListItems":[{"id":"default1", "caption":"Default 1"}, {"id":"default2", "caption":"Default 2"}, {"id":"default3", "caption":"Default 3"}, {"id":"default4", "caption":"Default 4"}, {"id":"default5", "caption":"Default 5"}]}, {"id":"description", "width":700, "type":"input", "editable":true, "caption":"Deskripsi"}])
.setRows([{"cells":[{"value":"img/1.png", "id":"c_a"}, {"value":"Contoh slide 1", "id":"c_b"}], "id":"ac"}, {"cells":[{"value":"img/2.png", "id":"c_c"}, {"value":"Contoh slide 2", "id":"c_d"}], "id":"ad"}, {"cells":[{"value":"img/3.png", "id":"c_e"}, {"value":"Contoh slide 3", "id":"c_f"}], "id":"ae"}, {"cells":[{"value":"img/4.png", "id":"c_g"}, {"value":"Contoh slide 4", "id":"c_h"}], "id":"af"}, {"cells":[{"value":"img/5.png", "id":"c_i"}, {"value":"Contoh slide 5", "id":"c_j"}], "id":"ag"}, {"cells":[{"value":"img/6.png", "id":"c_k"}, {"value":"Contoh slide 6", "id":"c_l"}], "id":"ah"}, {"cells":[{"value":"img/7.png", "id":"c_m"}, {"value":"Contoh slide 7", "id":"c_n"}], "id":"ai"}])
);

return children;
// ]]Code created by CrossUI RAD Tools
},
_ctl_slideplaylist_oncommand: function (profile,src){
var ns = this, uictrl = profile.boxing();
_.asyRun(function(){
uictrl.setUIValue("asdfasfasf",true);
},300);
}
}
});
   
support
 
Posts: 352
Joined: Sat Apr 27, 2013 9:22 am

Re: About new version

Postby wahono77 » Thu Nov 28, 2013 12:01 pm

If we just setUIValue it's OK, but in my code after command button clicked, it open new form, and after new form closed, uictrl/profile.boxing is gone.
But this is old code that I was use, after update new verson, I got this problem
wahono77
 
Posts: 90
Joined: Sat Apr 13, 2013 6:04 am

Re: About new version

Postby support » Fri Nov 29, 2013 4:35 am

In new verion, by default, the editor will be destroyed when it lost focus.

You can use TreeGrid's "onCommand(profile, cell, proEditor, node)" event, and use updateCell to set value.
support
 
Posts: 352
Joined: Sat Apr 27, 2013 9:22 am

Re: About new version

Postby wahono77 » Fri Nov 29, 2013 8:09 am

Great, thanks, fixed now.
wahono77
 
Posts: 90
Joined: Sat Apr 13, 2013 6:04 am


Return to CrossUI for Desktop Apps

Who is online

Users browsing this forum: No registered users and 0 guests

cron