虚表 —— 选择框单选、多选模式
import win.ui; import godking.vlistEx; /*DSG{{*/ mainForm = win.form(text="vlistEx - table adapter";right=607;bottom=319;border="thin") mainForm.add( button={cls="button";text="Button";left=304;top=272;right=392;bottom=312;z=2}; checkbox={cls="checkbox";text="启用单选模式";left=16;top=272;right=128;bottom=304;z=3}; listview={cls="vlistEx";left=16;top=24;right=595;bottom=264;edge=1;z=1} ) /*}}*/ //======================= 创建虚表 ======================= mainForm.listview.setColumns("选择框单选模式") var t = { {"火影"}, {"鸣人"}, {"我爱罗"}, {"玉凤"}, {"哈哈哈"}} mainForm.listview.setTable(t,false); mainForm.listview.checkBox.show = true; //======================= 功能演示 ======================= mainForm.checkbox.oncommand = function(id,event){ mainForm.listview.singleCheckedMode = mainForm.checkbox.checked; mainForm.listview.setChecked(); } mainForm.button.oncommand = function(id,event){ import console var t,tt = mainForm.listview.getChecked(,1/*列号或字典key*/); console.dump(t,tt) } mainForm.show(); win.loopMessage();