![](https://aardio.online/upload/files/20240614/1718338084.png)
import win.ui;
import godking.vlistEx;
/*DSG{{*/
mainForm = win.form(text="vlistEx - table adapter";right=399;bottom=351)
mainForm.add(
vlist={cls="vlistEx";left=10;top=10;right=384;bottom=344;db=1;dl=1;dr=1;dt=1;edge=1;transparent=1;z=1}
)
/*}}*/
var t = { fields={"序号","年龄","金额"} };
for(i=1;100;1){
var tt={};
tt["序号"]="[@rowindex]"; // 行序号标记是不允许编辑修改的
tt["年龄"]=math.random(10,99);
tt["金额"]=..string.format("%.2f",..math.random(1000,9999)/100);
..table.push(t,tt);
}
mainForm.vlist.setTable(t,,100,1);
mainForm.vlist.onEditBegin = true;
mainForm.vlist.onEditEnd = function(row/*行*/,col/*列*/,text/*内容*/){
select(col) {
case 2 {
var r = ..tostring((..tonumber(text)):0);
if r != text {
..win.msgbox(text++" 将转为:"++r);
return r;
}
}
case 3 {
var r = ..tonumber(text):0;
return ..string.format("%.2f",r);
}
}
return true;
}
mainForm.show();
win.loopMessage();