Jump to content

Help with GUISetAcclerators


Recommended Posts

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.

#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.

Link to post
Share on other sites

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 ;)

Link to post
Share on other sites

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!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...