//编辑listview

import win.ui;
/*DSG{{*/
var winform = win.form( bottom=244;parent=...;right=343;text="AAuto Form" )
winform.add( 
listview={ bgcolor=16777215;bottom=182;right=310;left=25;top=23;z=1;editable=true;edge=1;cls="listview" };
btnEdit={ bottom=223;right=283;left=175;top=191;z=2;text="编辑当前选中项";cls="button" }
)
/*}}*/

//注意在上面的listview属性中,一定要指定 editable=true

winform.listview.insertColumn("测试项",200) 
winform.listview.items = {"鼠标点这里,稍候再点击一次";"鼠标单击选中项则进入编辑模式"}

winform.btnEdit.oncommand = function(id,event){
	winform.listview.editLable()
}

winform.listview.onnotify = function(id,code,ptr){
	 if(code = 0xFFFFFF97/*_LVN_BEGINLABELEDIT*/ ){ 
	 	return false; //允许编辑项
	 }
	 if( code == 0xFFFFFF96/*_LVN_ENDLABELEDIT*/ ){
	 	var dispInfo = winform.listview.getNotifyDispInfo(code,ptr); 
	 	if( dispInfo ? dispInfo.item.text ) {
	 		winform.listview.setItemText( dispInfo.item.text, dispInfo.item.iItem,dispInfo.item.iSubItem );
	 	}
	 }
}

winform.show()  
win.loopMessage();
