aardio父子窗口数据传递及虚表数据添加

redchina 17天前 177

对aardio父子窗口的数据不了解,学习案例,做个笔记,
父窗口代码

import win.ui;
import godking.vlistEx;
import fonts.fontAwesome;
/DSG{{/
var winform = win.form(text=“parent”;right=580;bottom=470)
winform.add(
button={cls=“button”;text=“叫出子窗体”;left=190;top=405;right=355;bottom=461;z=1};
edit={cls=“edit”;text=“Edit”;left=194;top=28;right=327;bottom=55;edge=1;multiline=1;z=3};
static={cls=“static”;text=“Static”;left=39;top=30;right=209;bottom=55;transparent=1;z=2};
vlist={cls=“vlistEx”;left=5;top=80;right=576;bottom=399;edge=1;z=4}
)
/}}/

winform.button.oncommand = function(id,event){
var child,wb = winform.loadForm(“\dlg\sun.aardio”, winform);

if(child) {
//winform.static.text = child.getDataForParent();
}

child.show();
}

winform.show();
win.loopMessage();

子窗口代码  :
import win.ui;
import godking.vlistEx;
import fonts.fontAwesome;
/*DSG{{*/
var winform = win.form(text="sun";right=319;bottom=268)
winform.add(
button={cls="button";text="隐藏父窗体";left=61;top=154;right=187;bottom=187;z=1};
button2={cls="button";text="叫出父窗体";left=63;top=196;right=186;bottom=226;z=2};
button3={cls="button";text="传送数据";left=58;top=68;right=191;bottom=99;z=4};
button4={cls="button";text="生成虚表数据";left=60;top=106;right=191;bottom=141;z=5};
edit={cls="edit";text="Edit";left=52;top=13;right=219;bottom=66;edge=1;multiline=1;z=3}
)
/*}}*/

winform.button2.oncommand = function(id,event){
//win.msgbox( winform.button2.text );
winform.parent.hide=false

}

winform.button.oncommand = function(id,event){

winform.parent.hide=true 

}

winform.button3.oncommand = function(id,event){
    var data = winform.edit.text;
    // 直接将edit控件的文本传递给父窗口的static控件
    winform.parent.static.text = data;  
    winform.parent.edit.text = data; 
    
    
    
    
}

winform.getDataForParent = function(){
    // 返回edit控件中的文本内容
    //return winform.edit.text; 
}

winform.button4.oncommand = function(id,event){
var t = { fields={"序号","姓名","年龄","地址","身份证"} };
for(i=1;10;1){
    var tt={};
    tt["序号"]="[@rowindex]";  // 行序号标记是不允许编辑修改的
    tt["姓名"]=math.random(1000,9999)+"姓名";
    tt["年龄"]=math.random(10,99);
    tt["地址"]=math.random(1000,9999)+"地址";
    tt["身份证"]=math.random(1000,9999)+"身份证";
    ..table.push(t,tt);
   
}
winform.parent.vlist.setTable(t,,{80,100,100,100,-1},1); 
}

winform.show(); 
win.loopMessage();
最新回复 (1)
  • redchina 17天前
    0 2

返回