JScript Posted June 4, 2014 Share Posted June 4, 2014 Hello everybody.Someone could inform how to prevent the arrow keys work in _GUICtrlToolbar_Create ? Thank you in advance, JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2014 Moderators Share Posted June 4, 2014 JScript,Do you mean that you want to hide the cursor in the edit control? If so the this thread should help. If not, what exactly do you mean? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JScript Posted June 4, 2014 Author Share Posted June 4, 2014 (edited) So, run the example below and use the arrow keys on the keyboard and see that they activate the buttons on the toll bar! #include <GuiToolbar.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> $Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hGUI, $hToolbar Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp ; Create GUI $hGUI = GUICreate("Toolbar", 400, 300) $hToolbar = _GUICtrlToolbar_Create($hGUI) GUISetState() ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main How to turn this off? JS Edited June 4, 2014 by JScript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2014 Moderators Share Posted June 4, 2014 (edited) JScript,If you look for the $HICF_ARROWKEYS message you can reset the focus to the edit like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiToolbar.au3> #include <WindowsConstants.au3> Global $g_hToolbar, $g_idMemo Global $g_iItem ; Command identifier of the button associated with the notification. Global Enum $e_idNew = 1000, $e_idOpen, $e_idSave, $e_idHelp Example() Func Example() Local $hGUI, $aSize ; Create GUI $hGUI = GUICreate("Toolbar", 600, 400) $g_hToolbar = _GUICtrlToolbar_Create($hGUI) $aSize = _GUICtrlToolbar_GetMaxSize($g_hToolbar) $g_idMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 336 - ($aSize[1] + 20), $WS_VSCROLL) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUICtrlCreateButton("", 10, 360, 80, 30) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap($g_hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton($g_hToolbar, $e_idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($g_hToolbar, $e_idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($g_hToolbar, $e_idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($g_hToolbar) _GUICtrlToolbar_AddButton($g_hToolbar, $e_idHelp, $STD_HELP) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite ; WM_NOTIFY event handler Func _WM_NOTIFY($hWndGUI, $iMsgID, $wParam, $lParam) #forceref $hWndGUI, $iMsgID, $wParam Local $tNMHDR, $hWndFrom, $iCode, $iNew, $iFlags, $iOld Local $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $g_hToolbar Switch $iCode Case $NM_LDOWN ;---------------------------------------------------------------------------------------------- MemoWrite("$NM_LDOWN: Clicked Item: " & $g_iItem & " at index: " & _GUICtrlToolbar_CommandToIndex($g_hToolbar, $g_iItem)) ;---------------------------------------------------------------------------------------------- Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $iOld = DllStructGetData($tNMTBHOTITEM, "idOld") $iNew = DllStructGetData($tNMTBHOTITEM, "idNew") $g_iItem = $iNew $iFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") If BitAND($iFlags, $HICF_LEAVING) = $HICF_LEAVING Then MemoWrite("$HICF_LEAVING: " & $iOld) ElseIf BitAND($iFlags, $HICF_ARROWKEYS) = $HICF_ARROWKEYS Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; The change in the hot item was caused by an arrow key ; So reset the focus to the edit _WinAPI_SetFocus($g_idMemo) Else Switch $iNew Case $e_idNew ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $e_idNew") ;---------------------------------------------------------------------------------------------- Case $e_idOpen ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $e_idOpen") ;---------------------------------------------------------------------------------------------- Case $e_idSave ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $e_idSave") ;---------------------------------------------------------------------------------------------- Case $e_idHelp ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idHelp") ;---------------------------------------------------------------------------------------------- EndSwitch EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFYAny use? M23Edit: Or after further testing you can just do this: ElseIf BitAND($iFlags, $HICF_ARROWKEYS) = $HICF_ARROWKEYS Then Return 0 Edited June 4, 2014 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JScript Posted June 4, 2014 Author Share Posted June 4, 2014 I had already done this test, but unfortunately does not work if the edit control is disabled, see:expandcollapse popup#include <GuiToolbar.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> $Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work Global $hToolbar, $iMemo Global $iItem ; Command identifier of the button associated with the notification. Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp _Main() Func _Main() Local $hGUI, $aSize ; Create GUI $hGUI = GUICreate("Toolbar", 600, 400) $hToolbar = _GUICtrlToolbar_Create($hGUI) $aSize = _GUICtrlToolbar_GetMaxSize($hToolbar) GUICtrlCreateLabel("Teste", 0, 0) $iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL) ; ----> Note: I want to disable edit control!!! GUICtrlSetState(-1, $GUI_DISABLE) ; <---- GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite ; WM_NOTIFY event handler Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tNMHDR, $hwndFrom, $code, $i_idNew, $dwFlags, $i_idOld Local $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") $code = DllStructGetData($tNMHDR, "Code") Switch $hwndFrom Case $hToolbar Switch $code Case $NM_LDOWN ;---------------------------------------------------------------------------------------------- MemoWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex($hToolbar, $iItem)) ;---------------------------------------------------------------------------------------------- Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld") $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew") $iItem = $i_idNew $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then MemoWrite("$HICF_LEAVING: " & $i_idOld) Elseif BitAND($dwFlags, $HICF_ARROWKEYS) = $HICF_ARROWKEYS Then _WinAPI_SetFocus($iMemo) Else Switch $i_idNew Case $idNew ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idNew") ;---------------------------------------------------------------------------------------------- Case $idOpen ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idOpen") ;---------------------------------------------------------------------------------------------- Case $idSave ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idSave") ;---------------------------------------------------------------------------------------------- Case $idHelp ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idHelp") ;---------------------------------------------------------------------------------------------- EndSwitch EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFYAnd I need the edit control is disabled,JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2014 Moderators Share Posted June 4, 2014 (edited) JScript,Fussy! M23 Edited June 4, 2014 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2014 Moderators Share Posted June 4, 2014 JScript,I have just seen this line:I had already done this testIf this was indeed the case then I do not appreciate you not saying so from the start - as I would not have wasted my time searching for it as a possible solution. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JScript Posted June 4, 2014 Author Share Posted June 4, 2014 @Melba23Forgive me, but be assured that it was an error on Google Translator!I meant that "I tested your code, but unfortunately it did not work."Note: I had to by the quotes "" to get the translation right.JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2014 Moderators Share Posted June 4, 2014 JScript,No problems. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JScript Posted June 4, 2014 Author Share Posted June 4, 2014 I'm glad you understood!But does this not have a solution?JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Solution UEZ Posted June 4, 2014 Solution Share Posted June 4, 2014 (edited) What about this here? expandcollapse popup#include <GuiToolbar.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPISys.au3> $Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work Global $hToolbar, $iMemo, $hEdit, $hToolbarWndProc, $hOldToolbarProc Global $iItem ; Command identifier of the button associated with the notification. Global Enum $idNew = 1000, $idOpen, $idSave, $id_Help _Main() Func _Main() Local $hGUI, $aSize, $iDummy ; Create GUI $hGUI = GUICreate("Toolbar", 600, 400) $iDummy = GUICtrlCreateLabel("", 10, 10, 1, 1) $hToolbar = _GUICtrlToolbar_Create($hGUI) $aSize = _GUICtrlToolbar_GetMaxSize($hToolbar) ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $id_Help, $STD_HELP) ;~ GUICtrlCreateLabel("Teste", 0, 0) $iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL) $hEdit = GUICtrlGetHandle($iMemo) ; ----> Note: I want to disable edit control!!! ; <---- GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() $hToolbarWndProc = DllCallbackRegister("ToolbarWndProc", "long", "hwnd;uint;wparam;lparam") $hOldToolbarProc = _WinAPI_SetWindowLong($hToolbar, $GWL_WNDPROC, DllCallbackGetPtr($hToolbarWndProc)) GUICtrlSetState($iMemo, $GUI_DISABLE) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_SetWindowLong($hToolbar, $GWL_WNDPROC, $hOldToolbarProc) DllCallbackFree($hToolbarWndProc) GUIDelete() Exit EndFunc ;==>_Main ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Func ToolbarWndProc($hWnd, $iMsg, $wParam, $lParam) Switch $wParam Case 37, 38, 39, 40 ;left, up, right, down _WinAPI_SetFocus($hEdit) Return 0 EndSwitch Return _WinAPI_CallWindowProc($hOldToolbarProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>ToolbarWndProc Btw, $idHelp is already defined in one of the UDFs! Is this wanted? Br, UEZ Edited June 4, 2014 by UEZ JScript 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
JScript Posted June 4, 2014 Author Share Posted June 4, 2014 Perfect my friend, is what I need, thank you!JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now