找回密码
 加入
搜索
查看: 2486|回复: 5

[GUI管理] 求教关于treeview触发事件的问题

[复制链接]
发表于 2013-11-21 19:14:15 | 显示全部楼层 |阅读模式
我希望在单机某treeviewitem的时候触发一个事件,用guigetmsg()无法获取到与treeview相同的id。
除了用guiregistermsg还有没其他办法实现呢?
先谢谢了。。。
 楼主| 发表于 2013-11-21 19:18:20 | 显示全部楼层
用这种方法无效:
guicreate("form")
$htv=guictrlcreatetreeview("",0,0,100,100)
guisetstate()
for $i=1 to 10
guictrlcreatetreeviewitem("item"&$i,$htv)
next

while 1
if guigetmsg()=-3 then exit
if guigetmsg()=$htv then msgbox(0,'ok','click')
wend
发表于 2013-11-21 20:04:00 | 显示全部楼层
回复 2# kxing
Local $aItem[10]
guicreate("form")
$htv=guictrlcreatetreeview("",0,0,100,100)
guisetstate()
for $i=1 to 10
$aItem[$i-1] = guictrlcreatetreeviewitem("item"&$i,$htv)
next

while 1
        $msg = guigetmsg()
Select
        
        Case  $msg =-3 
                exit
                Case ($msg >= $aItem[0] And $msg <= $aItem[9])
         msgbox(0,'ok','ID: ' & $msg & ' == ID2: ' & $aItem[$msg-$htv-1])
 EndSelect
wend
 楼主| 发表于 2013-11-22 19:32:22 | 显示全部楼层
嘿嘿,这也是种方法,不过item这样处理不大方便。。。
感谢楼上的回答!!
发表于 2013-11-22 21:04:29 | 显示全部楼层
wm_notify 应该准确点
具体你搜索下
 楼主| 发表于 2013-11-30 23:11:04 | 显示全部楼层
notify的话就要注册消息函数了。
这样与之关联的控件都要全局变量。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-3 01:14 , Processed in 0.076907 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表