aauto的listview(类似于C#的datagrid) 支持文件拖拽获取名单
import win.ui;/*DSG{{*/var winform = ..win.form( bottom=397;parent=...;right=596;text="AAuto Form" ) winform.add( checkbox5={ bottom=386;text="项五";left=433;top=370;z=8;right=482;cls="checkbox" }; checkbox2={ bottom=386;text="项二";left=286;top=370;z=5;right=335;cls="checkbox" }; listview={ bgcolor=16777215;bottom=357;right=591;left=6;top=5;acceptfiles=1;z=2;fullRow=1;edge=1;cls="listview" }; edit={ text="分割符 ";bottom=387;right=96;left=9;top=366;z=3;edge=1;cls="edit" }; button={ bottom=390;right=581;left=486;top=363;z=1;text="开始导出";cls="button" }; checkbox3={ bottom=386;text="项三";left=335;top=370;z=6;right=382;cls="checkbox" };static={ bottom=386;right=192;left=104;text="拖放文件即可";top=368;z=4;transparent=1;cls="static" }; checkbox4={ bottom=386;text="项四";left=385;top=370;z=7;right=434;cls="checkbox" } )/*}}*/ creatTeltable=function(){//winform.listview.setExtended(0x4/*_LVS_EX_CHECKBOXES*/);//勾选框winform.listview.insertColumn("序号",40,1) winform.listview.insertColumn("项二",120,2) winform.listview.insertColumn("项三",120,3) winform.listview.insertColumn("项四",120,4) winform.listview.insertColumn("项五",120,5) } creatTeltable() winform.listview.wndproc = function(hwnd,message,wParam,lParam){ select(message) {case 0x233/*_WM_DROPFILES*/{ winform.listview.clear(); path = win.getDropFile(wParam )[1]; var x = 1; for line in io.lines(path) { //采取分行迭代方法读取test.txt文本的内容;var a,b,c,d,e = table.unpack(string.split(line,"<"+ winform.edit.text +">")); //string.split以“ ”为分割符分割读取的文本行 然后把分开的值分别赋值给a,b,模式匹配详细请参考帮助文档和论坛; winform.listview.addItem({tostring(x);a;b;c;d;e});//显示到listview控件;x++; } } }//无返回值则继续调用默认回调函数} winform.button.oncommand = function(id,event){//winform.msgbox( winform.button.text );for(i=1;winform.listview.count;1){var xinxi = ""if(winform.checkbox2.checked){ xinxi = xinxi ++ winform.listview.getItemText(i,2) ++ winform.edit.text }if(winform.checkbox3.checked){ xinxi = xinxi ++ winform.listview.getItemText(i,3) ++ winform.edit.text }if(winform.checkbox4.checked){ xinxi = xinxi ++ winform.listview.getItemText(i,4) ++ winform.edit.text }if(winform.checkbox5.checked){ xinxi = xinxi ++ winform.listview.getItemText(i,5) } string.save("xinxi.txt", tostring(xinxi) + '\r\n' ,true) } win.msgbox("搞定","ok") } /** winform.wndproc = function(hwnd,message,wparam,lparam){ select(message) {//判断消息类型 case 0x10/*_WM_CLOSE窗口关闭消息*/{ if(win.msgboxTest("你要关闭窗口么?","询问")=false){ return wparam; } } } //无返回值则继续调用默认回调函数 } **/ winform.show() win.loopMessage();
本文转载自:http://bbs.carlaau.com/AAuto_source/t34-1-1.html
打赏
0 赞
0 收藏
分享
赞 (0)