Digisoul 1 Posted May 9, 2010 Hello there, I am trying to define GUISetAccelerators on the child window but i think there is something which i can't understand to solve the issue, here is a sample code #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode",1) Global $main,$child $main = GUICreate("Form1", 633, 447, 192, 200) GUISetState() $child = GUICreate("Form1", 200, 200, 0, 0,$WS_CHILD,-1,$main) $b = GUICtrlCreateButton("test button",0,0) GUICtrlSetOnEvent($b,"ENTER") Dim $k[1][2] = [ ["{ENTER}",$b] ] GUISetAccelerators($k,$child) GUISetState() While 1 Sleep(100) WEnd Func ENTER() ConsoleWrite("> Working at "&@GUI_WinHandle & $child) EndFunc 73 108 111 118 101 65 117 116 111 105 116 Share this post Link to post Share on other sites
Yoriz 6 Posted May 9, 2010 The child window does not have focus when you start the script so pressing enter does nothing , if you click on the button the child gui gains focus and it works, if you set the focus to the button like below it works straight away. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode",1) Global $main,$child $main = GUICreate("Form1", 633, 447, 192, 200) GUISetState() $child = GUICreate("Form1", 200, 200, 0, 0,$WS_CHILD,-1,$main) $b = GUICtrlCreateButton("test button",0,0) GUICtrlSetOnEvent($b,"ENTER") Dim $k[1][2] = [ ["{ENTER}",$b] ] GUISetAccelerators($k,$child) GUISetState() GUICtrlSetState ($b, $GUI_FOCUS) While 1 Sleep(100) WEnd Func ENTER() ConsoleWrite("> Working at "&@GUI_WinHandle & $child & @CR) EndFunc GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Share this post Link to post Share on other sites
Digisoul 1 Posted May 9, 2010 The child window does not have focus when you start the script so pressing enter does nothing , if you click on the button the child gui gains focus and it works, if you set the focus to the button like below it works straight away. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode",1) Global $main,$child $main = GUICreate("Form1", 633, 447, 192, 200) GUISetState() $child = GUICreate("Form1", 200, 200, 0, 0,$WS_CHILD,-1,$main) $b = GUICtrlCreateButton("test button",0,0) GUICtrlSetOnEvent($b,"ENTER") Dim $k[1][2] = [ ["{ENTER}",$b] ] GUISetAccelerators($k,$child) GUISetState() GUICtrlSetState ($b, $GUI_FOCUS) While 1 Sleep(100) WEnd Func ENTER() ConsoleWrite("> Working at "&@GUI_WinHandle & $child & @CR) EndFunc Thanks for your reply. What will you say about this condition ? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode",1) Global $main,$child $main = GUICreate("Form1", 633, 447, 192, 200) GUISetState() $child = GUICreate("Form1", 200, 200, 0, 0,$WS_CHILD,-1,$main) $i = GUICtrlCreateInput("Enter is not working ???",0,0) $b = GUICtrlCreateDummy() GUICtrlSetOnEvent($b,"ENTER") Dim $k[1][2] = [ ["{ENTER}",$b] ] GUISetAccelerators($k,$child) GUISetState() GUICtrlSetState ($i, $GUI_FOCUS) While 1 Sleep(100) WEnd Func ENTER() ConsoleWrite("> Working at "&@GUI_WinHandle & $child & @CR) EndFunc if you delete the $child gui & set GUISetAccelerators($k,$main) it will work perfect. What is solution for this type of situations ? 73 108 111 118 101 65 117 116 111 105 116 Share this post Link to post Share on other sites