aardio 文档
aardio 范例: 树视图(treeview)控件 - 鼠标单击取当前节点
//树视图(treeview)控件 - 鼠标单击取当前节点
import win.ui;
import win.ui.menu
/*DSG{{*/
var winform = win.form(text="aardio form";right=577;bottom=372;parent=...)
winform.add(
static={cls="static";text="请点击左侧节点";left=268;top=47;right=530;bottom=77;transparent=1;z=2};
treeview={cls="treeview";left=10;top=10;right=217;bottom=361;asel=false;bgcolor=15793151;db=1;dl=1;dt=1;edge=1;hscroll=1;infoTip=1;vscroll=1;z=1}
)
/*}}*/
//树视图(treeview)鼠标单击触发 onClick 事件。
winform.treeview.onClick = function(hItem,data){
winform.static.text = winform.treeview.getItemText(hItem);
}
//树视图(treeview)鼠标右键单击触发 onRightClick 事件。
winform.treeview.onRightClick = function(hItem,data){
var x,y = win.getMessagePos();
var menu = win.ui.popmenu(winform)
menu.add("删除",
function(){
winform.treeview.delItem(hItem)
}
)
menu.popup(x,y,true);
}
//添加表对象到树视图(treeview)
hitem = winform.treeview.insertItem( {
"节点一";
"节点二";
{ text = "目录";
children = {
"节点三";
"节点四"
}
}
} )
winform.show()
win.loopMessage();
Markdown 格式