import win.ui; |
import string; |
import fsys.dlg |
/*DSG{{*/ |
var winform = ..win.form(text="AAuto Form";right=426;bottom=296;parent=...) |
winform.add( |
button={cls="button";text="导入文件1";left=27;top=12;right=102;bottom=33;z=1}; |
button2={cls="button";text="导入文件2";left=110;top=12;right=185;bottom=33;z=3}; |
button3={cls="button";text="导出";left=193;top=12;right=268;bottom=33;z=4}; |
listview={cls="listview";left=25;top=41;right=402;bottom=261;bgcolor=16777215;edge=1;z=2} |
) |
/*}}*/ |
winform.button3.oncommand = function(id,event){ |
var path = fsys.dlg.save( |
"*.txt|*.txt|", |
io.fullpath("") |
) |
if(!io.exist(path)){ |
return ; |
} |
string.save(path,"") |
for(i=1;winform.listview.count;1){ |
var txt = winform.listview.getItemText(i,4) |
if(txt){ |
string.save( path,txt++'\r\n',true ) |
} |
} |
} |
winform.button2.oncommand = function(id,event){ |
var path=fsys.dlg.open() |
if(!io.exist(path)){ |
return ; |
} |
var listlen = winform.listview.count |
for(i=1;listlen;1){ |
txt2 = winform.listview.getItemText(i,2) |
var txt3 = "" |
for line in io.lines(path) { |
if(!#line){ |
continue ; |
} |
if(line = txt2){ |
txt3 = line |
} |
} |
if(txt3 = ""){ |
txt4 = winform.listview.getItemText(i,2) |
winform.listview.setItemText(txt4,i,4) |
}else { |
winform.listview.setItemText(txt3,i,3) |
} |
} |
} |
winform.listview.insertColumn("行数",50) |
winform.listview.insertColumn("数据1",100) |
winform.listview.insertColumn("数据2",100) |
winform.listview.insertColumn("数据3",100) |
winform.button.oncommand = function(id,event){ |
var path=fsys.dlg.open() |
if(!io.exist(path)){ |
return ; |
} |
winform.listview.clear(); |
for line in io.lines(path) { |
if(!#line){ |
continue ; |
} |
var h=winform.listview.addItem() |
winform.listview.setItemText(tostring(h),h,1) |
winform.listview.setItemText(line,h,2) |
} |
} |
winform.show() |
win.loopMessage(); |
return winform; |