aardio 文档
aardio 范例: 请拖动需要监视的目录到下面的文件列表内
//仅监视目录 fsys.watch
import win.ui;
/*DSG{{*/
var winform = ..win.form(text="请拖动需要监视的目录到下面的文件列表内";right=599;bottom=387;max=false;)
winform.add(
btnWatch={cls="button";text="开始监视";left=377;top=342;right=529;bottom=379;z=1};
lvChange={cls="listview";left=7;top=6;right=587;bottom=334;acceptfiles=1;bgcolor=16777215;edge=1;z=2}
)
/*}}*/
import fsys.watch;
watchFiles = function( files ){
var watchObj = fsys.watch( files ) ;
winform.watchObj = watchObj;
watchObj.onChange = function(path) {
var item = winform.lvChange.findItem(path);
if( item ){
winform.lvChange.setItemText("改变",item,2);
winform.lvChange.setItemText(tostring(time.now()),item,3);
}
}
watchObj.run();
}
winform.btnWatch.oncommand = function(id,event){
if( winform.btnWatch.text == "开始监视"){
winform.btnWatch.text = "停止监视";
watchFiles( winform.files);
}
else {
winform.btnWatch.text = "开始监视";
winform.watchObj.stop();
}
}
import fsys;
winform.lvChange.wndproc = {
[0x233/*_WM_DROPFILES*/] = function(hwnd,message,wParam,lParam){
var files = win.getDropFile(wParam)
for(i=1;#files;1){
if( fsys.isDir(files[i]) )
winform.lvChange.addItem(files[i])
}
winform.files = table.concat(files,winform.files : {} );
}
}
winform.lvChange.insertColumn("文件",100)
winform.lvChange.insertColumn("状态",100)
winform.lvChange.insertColumn("时间",200)
winform.lvChange.fillParent(1);
winform.show()
win.loopMessage();
Markdown 格式