table配置文件案例
本帖最后由 axuanup 于 2024-1-22 14:20 编辑import win.ui;
/*DSG{{*/
mainForm = win.form(text="aardio工程";right=507;bottom=361)
mainForm.add(
button={cls="button";text="增加";left=209;top=35;right=287;bottom=66;z=1};
button2={cls="button";text="删除";left=209;top=79;right=287;bottom=110;z=3};
button3={cls="button";text="修改";left=209;top=125;right=287;bottom=156;z=4};
listbox={cls="listbox";left=63;top=29;right=177;bottom=323;edge=1;items={};vscroll=1;z=2}
)
/*}}*/
import fsys;
import fsys.config;
import web.json; //JSON解析器
import fsys.table;
import console;
//var path = io.fullpath("\config.table")
var config = fsys.table("/config.table")
config.load(); //从文件载入表
mainForm.listbox.items = config;
mainForm.button.oncommand = function(id,event){
config[#config+1] = #config+1
mainForm.listbox.add(tostring(#config))
//console.dump(config)
config.save();
}
mainForm.button2.oncommand = function(id,event){
var num = mainForm.listbox.selIndex;
table.remove(config,num)
//console.dump(config)
mainForm.listbox.delete()
mainForm.listbox.selIndex = num
config.save();
}
mainForm.show();
return win.loopMessage();
好像修改功能实现不了呢
页:
[1]