OnEven模式调用子另一个OnEven模式子窗口,子窗口按键都失效了。
#include <ComboConstants.au3>#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 378, 31, 545, 172)
GUISetFont(9, 400, 0, "新細明體")
GUISetBkColor(0x808080)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Input1 = GUICtrlCreateInput("入", 5, 5, 50, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont(-1, 8, 400, 0, "新細明體")
GUICtrlSetColor(-1, 0xC0C0C0)
GUICtrlSetBkColor(-1, 0xF1EFE2)
GUICtrlSetOnEvent(-1, "Input1Change")
$Input2 = GUICtrlCreateInput("中出", 56, 5, 50, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont(-1, 8, 400, 0, "新細明體")
GUICtrlSetColor(-1, 0xC0C0C0)
GUICtrlSetBkColor(-1, 0xF1EFE2)
GUICtrlSetOnEvent(-1, "Input2Change")
$Input3 = GUICtrlCreateInput("中入", 107, 5, 50, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont(-1, 8, 400, 0, "新細明體")
GUICtrlSetColor(-1, 0xC0C0C0)
GUICtrlSetBkColor(-1, 0xF1EFE2)
GUICtrlSetOnEvent(-1, "Input3Change")
$Input4 = GUICtrlCreateInput("出", 158, 5, 50, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont(-1, 8, 400, 0, "新細明體")
GUICtrlSetColor(-1, 0xC0C0C0)
GUICtrlSetBkColor(-1, 0xF1EFE2)
GUICtrlSetOnEvent(-1, "Input4Change")
$Input5 = GUICtrlCreateInput("單位", 220, 5, 50, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont(-1, 8, 400, 0, "新細明體")
GUICtrlSetColor(-1, 0xC0C0C0)
GUICtrlSetBkColor(-1, 0xF1EFE2)
GUICtrlSetOnEvent(-1, "Input5Change")
$Combo1 = GUICtrlCreateCombo("", 270, 5, 60, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "天|小時|分鐘", "天")
GUICtrlSetFont(-1, 8, 400, 0, "新細明體")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0xF1EFE2)
GUICtrlSetOnEvent(-1, "Combo1Change")
$Icon1 = GUICtrlCreateIcon("D:\softare\rosterSetup\images\bullet_cross_16.ico", -1, 336, 6, 16, 16)
GUICtrlSetOnEvent(-1, "Icon1Click")
$Icon2 = GUICtrlCreateIcon("D:\softare\rosterSetup\images\check_16.ico", -1, 355, 5, 16, 16)
GUICtrlSetOnEvent(-1, "Icon2Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func Combo1Change()
EndFunc
Func Form1Close()
EndFunc
Func Form1Maximize()
EndFunc
Func Form1Minimize()
EndFunc
Func Form1Restore()
EndFunc
Func Icon1Click()
Exit
EndFunc
Func Icon2Click()
MsgBox(0,"","1")
aa()
EndFunc
Func Icon3Click()
MsgBox(0,"","2")
EndFunc
Func Input1Change()
EndFunc
Func Input2Change()
EndFunc
Func Input3Change()
EndFunc
Func Input4Change()
EndFunc
Func Input5Change()
EndFunc
Funcaa()
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form1", 378, 31, 545, 172)
GUISetFont(9, 400, 0, "新細明體")
GUISetBkColor(0x808080)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form2Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form2Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form2Restore")
$Input6 = GUICtrlCreateInput("入", 5, 5, 50, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont(-1, 8, 400, 0, "新細明體")
GUICtrlSetColor(-1, 0xC0C0C0)
GUICtrlSetBkColor(-1, 0xF1EFE2)
GUICtrlSetOnEvent(-1, "Input6Change")
$Icon3 = GUICtrlCreateIcon("D:\softare\rosterSetup\images\check_16.ico", -1, 336, 6, 16, 16)
GUICtrlSetOnEvent(-1, "Icon3Click")
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
EndFunc
我和你遇到了同样的问题,现在正在苦恼!!! 回复 1# eason
這個問題是解決沒~~~怎麼又是發在解決問題區
最近怎麼一堆新手 把問題發在解決問題區 这个不是问题的问题......... 回复 1# eason
大哥請拜讀 ~~~~下面這篇文章
http://www.autoitx.com/forum.php?mod=viewthread&tid=476&from=favorites
借用文章中的 一段程式, 這段程式看得懂 你就會了~~~
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$main = GuiCreate("MyGUI", 340, 60,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
$Button_1 = GuiCtrlCreateButton("Button1", 10, 10, 100, 40)
$Button_2 = GuiCtrlCreateButton("Button2", 120, 10, 100, 40)
$Button_3 = GuiCtrlCreateButton("Button3", 230, 10, 100, 40)
GUISetState()
GuiCreate("子窗口1", 140, 60,10,100,-1,-1,$main)
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
GUISetState()
GuiCreate("子窗口2", 140, 60,160,100,-1,-1,$main)
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
GUISetState()
GuiCreate("子窗口3", 140, 60,300,100,-1,-1,$main)
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
GUICtrlSetOnEvent($Button_2, "gui")
GUICtrlSetOnEvent($Button_3, "gui")
GUICtrlSetOnEvent($Button_1, "gui")
While 1
;;;
WEnd
Exit
Func gui()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Switch @GUI_WINHANDLE
Case $main
Exit
Case Else
MsgBox(0,"","關閉窗口:"&WinGetTitle(@GUI_WINHANDLE))
GUIDelete(@GUI_WINHANDLE)
EndSwitch
Case $Button_2
MsgBox(0,"","按下了Button_2")
Case $Button_3
MsgBox(0,"","按下了Button_3")
Case $Button_1
MsgBox(0,"","按下了Button_1")
EndSwitch
EndFunc ;==>gui
回复 3# kk_lee69
問題 解決的話請改為 [已解決]
页:
[1]