//checklist响应点选
import win.ui;
/*DSG{{*/
var winform = win.form(text="复选列表框 响应通知消息演示";right=349;bottom=249;max=false;parent=...)
winform.add(
checklist={cls="checklist";left=20;top=45;right=326;bottom=224;bgcolor=16777215;edge=1;items={};z=1};
static={cls="static";text="请点选项目";left=22;top=21;right=268;bottom=45;transparent=1;z=2}
)
/*}}*/

winform.checklist.items = { {"测试项目"};{"测试项目2"};{"测试项目3"} }   
winform.checklist.addItem("测试项目4")  
winform.checklist.addItem("测试项目5")  

import win.ui.menu;
winform.checklist.onnotify = function(id,code,ptr){  
 	 if( code == 0xFFFFFF9B/*_LVN_ITEMCHANGED*/ ){ 
 	 	var nmListView = winform.checklist.getNotifyMessage(code,ptr);
 	 	if( !nmListView )
 	 		return;
 	 		
 	 	if( nmListView.uNewState & 0xF000/*_LVIS_STATEIMAGEMASK*/){
 	 		var selIndex = nmListView.iItem;
 	 		if( winform.checklist.getChecked( selIndex ) )
 	 			winform.static.text = "选中:" + selIndex
 	 		else {
 	 			winform.static.text = "取消选中:" + selIndex
 	 		} 
 	 	}  
 	 }
 	 elseif( code = 0xFFFFFFFB/*_NM_RCLICK*/ ){
 	 
 	 	var x,y = win.getMessagePos();  
 	 	var nmListView = winform.checklist.getNotifyMessage(code,ptr);
 	 	//创建弹出菜单
		var popmenu = win.ui.popmenu(winform); 
		popmenu.add('删除',function(id){ 
				winform.checklist.delItem( nmListView.iItem )
		} ) 
		popmenu.popup(x,y,true);
		popmenu.close();
 	 }
}
 
winform.show() 
win.loopMessage();