把treeview的所有被勾选的子节点数据,点击按钮后,发送到edit文本框的问题
请教一下,我想把treeview的所有被勾选的子节点数据,点击按钮后,发送到edit文本框,实现不了,麻烦看一下我的代码错在哪,谢谢了://复选框多级同步
import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=390;bottom=414)
winform.add(
button={cls="button";text="Button";left=21;top=270;right=102;bottom=299;z=2};
edit={cls="edit";text="Edit";left=21;top=318;right=343;bottom=392;edge=1;multiline=1;z=3};
treeview={cls="treeview";left=10;top=11;right=336;bottom=233;asel=false;bgcolor=16777215;chkBox=1;edge=1;z=1}
)
/*}}*/
//添加节点
var hitem = winform.treeview.insertItem( {
text = "下面用一个数组指定子节点"; {
{text = "子节点1"};
{text = "子节点2" };
{text = "下面用一个数组指定子节点"; {
"a";"b";"c";{ text = "d" }
}
};
}
} )
winform.button.oncommand = function(id,event){
winform.edit.Text =""
winform.treeview.enum(
function(hItem,parent){
winform.treeview.setChecked(hItem,true)
var hItem = winform.treeview.getChildItem(hItem)
var text = winform.treeview.getChildItem(hItem);
winform.edit.appendText(text + "\n");
}
)
}
winform.show()
win.loopMessage();
var text = winform.treeview.getChildItem(hItem);这个修改为var text = winform.treeview.getItemText(hItem); 非常感谢!!
页:
[1]