添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
import fsys.dlg;
/*DSG{{*/
var winform = win.form( bottom=445;text= "aardio listview的用法" ;right=592;maxmize=1 )
winform.add(
listview={ ah=1;bgcolor=16777215;color=0;right=567;left=23;dt=1;cls=
"listview" ;bottom=420;text= "listview" ;
items={  };font=LOGFONT( name=
"宋体" ;h=-12; );z=1;aw=1;edge=1;top=177 };
button3={ dl=1;bottom=49;text=
"删除所有行" ;left=211;dt=1;top=22;font=LOGFONT( name= "宋体" ;h=-12 );z=4;right=290;cls= "button" };
static5={ dl=1;bottom=129;align=
"right" ;right=99;left=46;dt=1;top=110;font=LOGFONT( name= "宋体" ;h=-12 );transparent=1;text= "行号" ;z=16;cls= "static" };
button6={ dl=1;bottom=49;text=
"读取TXT文件" ;left=473;dt=1;top=22;font=LOGFONT( name= "宋体" ;h=-12 );z=7;right=554;cls= "button" };
edit3={ dl=1;bottom=156;text=
"120" ;left=108;dt=1;top=136;font=LOGFONT( name= "宋体" ;h=-12 );z=11;right=206;edge=1;cls= "edit" };
button={ dl=1;bottom=49;text=
"添加" ;left=41;dt=1;top=22;font=LOGFONT( name= "宋体" ;h=-12 );z=2;right=120;cls= "button" };
button4={ dl=1;bottom=49;text=
"列目录文件名" ;left=297;dt=1;top=22;font=LOGFONT( name= "宋体" ;h=-12 );z=5;right=376;cls= "button" };
button2={ dl=1;bottom=49;text=
"删除当前行" ;left=127;dt=1;top=22;font=LOGFONT( name= "宋体" ;h=-12 );z=3;right=206;cls= "button" };
edit={ dl=1;bottom=80;right=500;left=147;dt=1;top=61;font=LOGFONT( name=
"宋体" ;h=-12 );z=19;text= "edit" ;edge=1;cls= "edit" };
groupbox={ dl=1;bottom=165;right=561;left=42;dt=1;top=90;font=LOGFONT( name=
"宋体" ;h=-12 );z=21;text= "添加/修改内容" ;edge=1;cls= "groupbox" };
static={ dl=1;bottom=129;align=
"right" ;right=270;left=217;dt=1;top=110;font=LOGFONT( name= "宋体" ;h=-12 );transparent=1;text= "文件名称" ;z=8;cls= "static" };
static4={ dl=1;bottom=158;align=
"right" ;right=404;left=351;dt=1;top=139;font=LOGFONT( name= "宋体" ;h=-12 );transparent=1;text= "修改日期" ;z=14;cls= "static" };
static2={ dl=1;bottom=159;align=
"right" ;right=99;left=46;dt=1;top=140;font=LOGFONT( name= "宋体" ;h=-12 );transparent=1;text= "文件大小" ;z=10;cls= "static" };
static3={ dl=1;bottom=159;align=
"right" ;right=270;left=217;dt=1;top=140;font=LOGFONT( name= "宋体" ;h=-12 );transparent=1;text= "文件类型" ;z=12;cls= "static" };
edit4={ dl=1;bottom=156;text=
"TXT" ;left=280;dt=1;top=136;font=LOGFONT( name= "宋体" ;h=-12 );z=13;right=343;edge=1;cls= "edit" };
static7={ dl=1;bottom=83;color=8388608;text=
"请选择要列出文件名称的文件夹" ;left=51;dt=1;top=60;font=LOGFONT( name= "宋体" ;h=-12; );z=18;right=141;transparent=1;cls= "static" };
edit1={ dl=1;bottom=124;text=
"1" ;left=108;dt=1;top=104;font=LOGFONT( name= "宋体" ;h=-12 );z=17;right=160;edge=1;cls= "edit" };
button7={ dl=1;bottom=78;right=542;left=504;dt=1;top=60;font=LOGFONT( name=
"宋体" ;h=-12 );z=20;text= "选择" ;cls= "button" };
edit5={ dl=1;bottom=156;text=
"2010/11/13" ;left=415;dt=1;top=136;font=LOGFONT( name= "宋体" ;h=-12 );z=15;right=549;edge=1;cls= "edit" };
button5={ dl=1;bottom=49;color=32768;text=
"修改" ;left=383;dt=1;top=22;font=LOGFONT( name= "宋体" ;h=-12; );z=6;right=462;cls= "button" };
edit2={ dl=1;bottom=124;text=
"c:\TEMP\测试记录.txt" ;left=280;dt=1;top=104;font=LOGFONT( name= "宋体" ;h=-12 );z=9;right=549;edge=1;cls= "edit" }
/*}}*/
var path1= ""
//“选择”按钮
winform.button7.oncommand = function (id,event){
path1 = fsys.dlg.opendir(
"" ) //打开文件夹选取窗口,并返回所选择的文件夹的路径
winform.edit.text=path1
winform.listview.wndproc =
function (hwnd,message,wparam,lparam){
select (message) { //判断消息类型
case 0x0203{ /*_WM_LBUTTONDBLCLK 双击鼠标左键*/
var nIndex = winform.listview.selIndex;
if (winform.listview.count>0){
winform.edit1.text=winform.listview.getItemText(nIndex,1);
winform.edit2.text=winform.listview.getItemText(nIndex,2);
winform.edit3.text=winform.listview.getItemText(nIndex,3);
winform.edit4.text=winform.listview.getItemText(nIndex,4);
winform.edit5.text=winform.listview.getItemText(nIndex,5);
//“读取TXT文件”按钮
winform.button6.oncommand = function (id,event){
var lintab={};
if ( io.exist( "c:\temp\训练记录.txt" ) ){
for lin in io.lines( "c:\temp\训练记录.txt" ){
if (#lin){
table.push(lintab,lin);
for (i=1;#lintab-1;1){
winform.listview.setItemText(lintab[ i ],i,2);
else {
winform.msgbox(
"c:\temp\训练记录.txt文件不存在" , "标题" )
//“修改”按钮
winform.button5.oncommand = function(id,event){
var nIndex = winform.listview.selIndex;
winform.listview.setItemText(winform.edit1.text,nIndex,1);
winform.listview.setItemText(winform.edit2.text,nIndex,2);
winform.listview.setItemText(winform.edit3.text,nIndex,3);
winform.listview.setItemText(winform.edit4.text,nIndex,4);
winform.listview.setItemText(winform.edit5.text,nIndex,5);
//“列目录文件名”按钮
winform.button4.oncommand = function(id,event){
if(io.exist(winform.edit.text)){
//批量处理文件
fsys.enum(  path1, //指定要遍历的目录
"*.*", //指定查询文件名,支持windows掩码
function(dir,filename){ //指定触发器
if(filename){
//console.log("发现文件:",dir + filename)
var i=winform.listview.count+1;
winform.listview.addItem();
winform.listview.setItemText(tostring(i),i,1);
winform.listview.setItemText(dir+filename,i,2);
var file1 = fsys.file(dir+filename);
var size1=tostring(file1.size/1024);//取文件大小,并转换为KB
size1=string.format("%.2f",size1);
winform.listview.setItemText(size1,i,3);
//以“.”号对文件名进行拆分
file2=string.split(tostring(filename),".");
//取最后一个数组值
winform.listview.setItemText(file2[#file2],i,4);
tm1 = file1.getFileTimes();
//tm.creation、tm.access、tm.write显示文件的创建、最后访问、最后修改时间
tm2=time.local(tm1.write)
tm2.format = "%Y/%m/%d %H:%M:%S";//改变格式化模式串
winform.listview.setItemText(tostring(tm2),i,5);
winform.listview.setItemText("测试内容",i,6);
file1.close(); //如果忘记关闭文件,自动关闭
else{
//console.log("发现目录:",dir)
}else {
winform.msgbox("请选择正确的文件夹!")
time.local = function(tm){
tm.format="!%c";//说明这是一个UTC时间,可参考帮助中的time库
return ..time(tonumber(tm)); //转换为本地时间并返回,否则会相差8小时
//“删除所有行”按钮
winform.button3.oncommand = function(id,event){
winform.listview.clear();
//“删除当前行”按钮
winform.button2.oncommand = function(id,event){
var nIndex = winform.listview.selIndex;
winform.listview.delItem(nIndex);//delItem区分大小写
winform.listview.setFocus();
//“添加”按钮
winform.button.oncommand = function(id,event){
var i=winform.listview.count+1;
winform.listview.addItem();
winform.listview.setItemText(tostring(i),i,1);
winform.listview.setItemText(winform.edit2.text,i,2);
winform.listview.setItemText(winform.edit3.text,i,3);
winform.listview.setItemText(winform.edit4.text,i,4);
winform.listview.setItemText(winform.edit5.text,i,5);
winform.listview.setItemText("测试内容",i,6);
winform.listview.insertColumn("行号",50,1,0x2/*_LVCFMT_CENTER*/)
winform.listview.insertColumn("文件名称",300,2,0x0/*_LVCFMT_LEFT*/)
//font2=::LOGFONT()
winform.listview.font = LOGFONT( h=-15;name="宋体")/*字体大小用负数表示*/
winform.listview.insertColumn('文件大小(KB)',110,3,0x1/*_LVCFMT_RIGHT*/);
winform.listview.insertColumn('文件类型',90,4,0x1/*_LVCFMT_RIGHT*/);
winform.listview.insertColumn('文件修改时间',170,5,0x2);
winform.listview.insertColumn("测试",90,6,0x2);
winform.listview.fullRow = true; //是否选中整行
winform.listview.gridLines = true; //是否显示网络线
//winform.listview.editable=true;
winform.show();
win.loopMessage();
3.listview网络线和字体的颜色能否修改,应怎么修改呢?
4.winform.listview.editable=true;不论设为真或假都会出错,不知该如何使用才正解?
5.winform.listview.insertColumn("行号",50,1,0x2/*_LVCFMT_CENTER*/)
winform.listview.insertColumn("文件名称",300,2,0x0/*_LVCFMT_LEFT*/)
设置的样式似乎不起作用,不知是不是我使用得不对?
6.我已经在窗口的“属性”中设置“最大化”的值为“TRUE”了,未发布时正常,发布后运行,窗口却是不会最大化?