Jump to content



Photo

Help with GUISetAcclerators


  • Please log in to reply
2 replies to this topic

#1 akRJ

akRJ

    Seeker

  • Active Members
  • 8 posts

Posted 25 April 2012 - 05:49 AM

I can't for the life of me see what I'm doing wrong here. I've searched up and down the forums and still can't figure it out. I just want 'enter' to call a function like it would with HotKeySet.

AutoIt         
#include <Array.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <Misc.au3> #include <GUIEdit.au3> #include <ScrollBarConstants.au3> #include <GUIComboBoxex.au3> #include <ComboConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 890, 648, 497, 263, $WS_SIZEBOX + $WS_SYSMENU , $WS_EX_TOPMOST) GUISetBkColor(0x000000) GUICtrlSetImage($form1, "icon.ico") GUISetOnEvent($GUI_EVENT_CLOSE, "_quit") $Input = GUICtrlCreateInput("", 8, 560, 609, 21) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUISetOnEvent($input, "test") GUICtrlSetBkColor($Input, 0x000000) GUICtrlSetColor($Input, 0x00FF00) $history = GUICtrlCreateEdit("", 8, 56, 609, 489) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetData(-1,  "Hello!"& @CRLF) GUICtrlSetBkColor($history, 0x000000) GUICtrlSetColor($history, 0x00FF00) $List1 = GUICtrlCreateList("", 648, 56, 161, 487) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetBkColor($List1, 0x000000) GUICtrlSetColor($List1, 0x00FF00) $hDummy = GUICtrlCreateDummy() GUISetOnEvent(-1, "test") GUISetState(@SW_SHOW) ;~ Dim $accelkeys[1][2]= [["{ENTER}", $hDummy ]] ;Does not work at all ;~ GUISetAccelerators($accelkeys) HotKeySet("{ENTER}", "test") ; works fine While 1 Sleep(10) WEnd Func test() MsgBox(1, "", "") EndFunc Func _quit() Exit EndFunc


Any help would be greatly appreciated. I'm feel like i'm taking crazy pills.





#2 AdmiralAlkex

AdmiralAlkex

    I'm on a boat

  • MVPs
  • 4,490 posts

Posted 25 April 2012 - 06:04 AM

You are using GUISetOnEvent() on both the input and dummy when you should be using GUICtrlSetOnEvent(). notice the difference?

See the helpfile for what they do and how they work, and if you can't get it to work, you know where to find us ;)

#3 akRJ

akRJ

    Seeker

  • Active Members
  • 8 posts

Posted 25 April 2012 - 07:17 AM

You are using GUISetOnEvent() on both the input and dummy when you should be using GUICtrlSetOnEvent(). notice the difference?

See the helpfile for what they do and how they work, and if you can't get it to work, you know where to find us ;)


You, my friend, are a lifesaver! Thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users