关于GuiGetMsg()得不到消息事件的问题
本帖最后由 piaoa_998 于 2010-6-9 13:33 编辑用GuiGetMsg()来获得消息事件,判断不同的操作,代码如下:
$Folder = @DesktopDir & "\AutoIt_log"
IF FileExists($Folder) then DirRemove($Folder,1);delete folder
If Not FileExists($Folder)Then DirCreate($Folder);Create The Dir
$Form1 = GUICreate("Form1", 625, 443, 193, 125)
$Label1 = GUICtrlCreateLabel("TEST", 56, 16, 507, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Browse...", 512, 160, 57, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Combo3 = GUICtrlCreateCombo("", 208, 216, 281, 25)
$Button2 = GUICtrlCreateButton("Browse...", 504, 216, 81, 25, 0)
$Button3 = GUICtrlCreateButton("Start", 224, 296, 193, 41, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
select
Case$nMsg=$Button1
fileopendialog(..)
Case$nMsg=$Button2
fileopendialog(..)
Case $nMsg=$Button3
Start()
Case $nMsg=$GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Func Start()
.....
EndFunc
选中button1,2,3 都不执行相应操作,是为什么呀?等各位指教 本帖最后由 piaoa_998 于 2010-6-9 11:30 编辑
等着牛人们的回答 {:face (394):},怎么没人解答呢。。。。 有提示没有 你的open参数都没写上,事件已经触发了的。 自己保存下去测试看看吧:
$Folder = @DesktopDir & "\AutoIt_log"
IF FileExists($Folder) then DirRemove($Folder,1);delete folder
If Not FileExists($Folder)Then DirCreate($Folder);Create The Dir
$Form1 = GUICreate("Form1", 625, 443, 193, 125)
$Label1 = GUICtrlCreateLabel("TEST", 56, 16, 507, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Browse...", 512, 160, 57, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Combo3 = GUICtrlCreateCombo("", 208, 216, 281, 25)
$Button2 = GUICtrlCreateButton("Browse...", 504, 216, 81, 25, 0)
$Button3 = GUICtrlCreateButton("Start", 224, 296, 193, 41, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
select
Case$nMsg=$Button1
; fileopendialog(..)
msgbox(0,'','button1')
Case$nMsg=$Button2
; fileopendialog(..)
msgbox(0,'','button2')
Case $nMsg=$Button3
; Start()
msgbox(0,'','start')
Case $nMsg=-3
Exit
EndSelect
WEnd
Func Start()
.....
EndFunc
fileopendialog那里我是省略了
不过现在问题暂时用另一种方法解决了,谢谢各位帮忙了 为什么不用guictrlgetonevent??? 为什么不用guictrlsetonevent???
页:
[1]