Skysnake

[solved] GUISetAccelerators(0) ; Remove accelerator link

3 posts in this topic

#1 ·  Posted (edited)

Hi All

Question, the Help file contains this:

Quote

They are only active when the GUI specified in the function is active

So, is it necessary to put 

GUISetAccelerators(0) ; Remove accelerator link

in the GUI?  Once the GUI is deleted, the Accelerators are gone...?

Enter like tab discussion contains this item.  Is it essential?

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites



Skysnake,

Once you delete the GUI any Accelerator keys linked to that GUI are also deleted.

In the script to which you linked it was necessary to remove the accelerator key linkage while the script was running in order to send the native key to the GUI, so I used:

GUISetAccelerators(0)

to do this and then promptly reset them once the native key had been sent. This is a similar situation to when you need to unbind a HotKey to use the native key within the called function.

I hope that is clear - please ask again if you have any questions.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

@Melba23 I do understand.  The implications for the GUI are not clear yet, but now I understand why and what to look for.  Thank you


Skysnake

Why is the snake in the sky?

Share this post


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

  • Similar Content

    • kcvinu
      By kcvinu
      Hi all,
      I know GUISetAccelerators() function is helpful to set a hotkey for my GUI. But which function should i use for setting a hotkey for a specific control only. Say, i have 3 Textboxes and a button in my form. I want to display a msg box when i press the enter key while keyboard focus is in the first textbox. When i used GUISetAccelerators function, it is firing the event regardless the focuds of the control.
    • AndyS01
      By AndyS01
      I have a GUI with several input boxes and I want to trap the ENTER key so I can call handlers for each one.   However, when I put in a HotKeySet() to trap the ENTER key, it traps it OK, but I also get traps when I press the ENTER key anywhere else on my desktop, no matter what GUI has focus, so I changed the code to use GUISetAccelerators().  I cannot see how to attach a handler for the ENTER key for each of my input controls.   My real script uses event mode (Opt("GUIOnEventMode", 1)), so that's what I'm using in my test code.   Here is my test code: #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <StructureConstants.au3> OnAutoItExitRegister("ExitStageLeft") Opt("GUICloseOnESC", 1) Opt("GUIEventOptions", 1) Opt("GUIOnEventMode", 1) ;; <===== Opt("WinTitleMatchMode", 1) Opt('MustDeclareVars', 1) Global $hWnd_list1, $hWnd_input1, $hGUI, $sWinTitle Global $iID_list1, $iID_input1 _Main() Exit (1) Func _Main() $sWinTitle = "ENTER key trap test" $hGUI = GUICreate($sWinTitle, 500, 230) GUICtrlCreateButton("Test", 5, 5, 50, 25) $iID_input1 = GUICtrlCreateInput("input1", 70, 5, 100, 25) $hWnd_input1 = GUICtrlGetHandle($iID_input1) $iID_list1 = GUICtrlCreateEdit("list1", 10, 40, 475, 190) $hWnd_list1 = GUICtrlGetHandle($iID_list1) GUICtrlSetData($iID_list1, "abcdefghijklmnopqrstuvwxyz" & @CRLF, 1) ConsoleWrite("+++: $iID_list1 = " & $iID_list1 & @CRLF) ConsoleWrite("+++: $iID_input1 = " & $iID_input1 & @CRLF) GUISetState() GUICtrlSetOnEvent($iID_list1, "handle_List1") GUICtrlSetOnEvent($iID_input1, "handle_Input1") GUISetOnEvent($GUI_EVENT_CLOSE, 'ExitStageLeft') Local $aAccelKeys[2][2] $aAccelKeys[0][0] = "{ENTER}" $aAccelKeys[0][1] = $iID_input1 $aAccelKeys[1][0] = "{ENTER}" $aAccelKeys[1][1] = $iID_list1 GUISetAccelerators($aAccelKeys) While (1) Sleep(250) WEnd EndFunc ;==>_Main Func ExitStageLeft() Exit (0) EndFunc ;==>ExitStageLeft Func handle_Input1() ConsoleWrite("+++: handle_Input1() entered" & @CRLF) EndFunc ;==>handle_Input1 Func handle_List1() ConsoleWrite("+++: handle_List1() entered" & @CRLF) EndFunc ;==>handle_List1