Sturmi Posted June 11, 2016 Share Posted June 11, 2016 Hey as I don't know exactly how it works I would need backspace and enter key as GUIRegisterMsg. Thanks in advance. And If someone got a tut on how it works please link it Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 11, 2016 Moderators Share Posted June 11, 2016 Sturmi. Why can you not use _IsPressed? 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...
Sturmi Posted June 11, 2016 Author Share Posted June 11, 2016 I want it only for my Listbox. got a wm_command for double click Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 11, 2016 Moderators Share Posted June 11, 2016 Sturmi, So use _IsPressed and check if the ListBox has focus. 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...
AutoBert Posted June 12, 2016 Share Posted June 12, 2016 Here the modified example script to _GUICtrlListBox_Create: expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Global $g_hListBox Example() Func Example() Local $hGUI ; Create GUI $hGUI = GUICreate("(UDF Created) List Box Create", 400, 296) $g_hListBox = _GUICtrlListBox_Create($hGUI, "String upon creation", 2, 2, 396, 296) GUISetState(@SW_SHOW) MsgBox($MB_SYSTEMMODAL, "Information", "Adding Items") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; Add files _GUICtrlListBox_BeginUpdate($g_hListBox) _GUICtrlListBox_ResetContent($g_hListBox) _GUICtrlListBox_InitStorage($g_hListBox, 100, 4096) _GUICtrlListBox_Dir($g_hListBox, @WindowsDir & "\win*.exe") _GUICtrlListBox_AddFile($g_hListBox, @WindowsDir & "\notepad.exe") _GUICtrlListBox_Dir($g_hListBox, "", $DDL_DRIVES) _GUICtrlListBox_Dir($g_hListBox, "", $DDL_DRIVES, False) _GUICtrlListBox_EndUpdate($g_hListBox) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox If Not IsHWnd($g_hListBox) Then $hWndListBox = GUICtrlGetHandle($g_hListBox) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $g_hListBox, $hWndListBox Switch $iCode Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box $iItem=_GUICtrlListBox_GetCurSel($hWndFrom) $s_Text=_GUICtrlListBox_GetText($hWndFrom,$iItem) _DebugPrint("$LBN_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "ItemIndex" & @TAB & $iItem& @CRLF & _ "ItemText:" & @TAB & $s_Text) ; no return value Case $LBN_ERRSPACE ; Sent when a list box cannot allocate enough memory to meet a specific request _DebugPrint("$LBN_ERRSPACE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $LBN_KILLFOCUS ; Sent when a list box loses the keyboard focus _DebugPrint("$LBN_KILLFOCUS" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $LBN_SELCANCEL ; Sent when the user cancels the selection in a list box _DebugPrint("$LBN_SELCANCEL" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $LBN_SELCHANGE ; Sent when the selection in a list box has changed _DebugPrint("$LBN_SELCHANGE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $LBN_SETFOCUS ; Sent when a list box receives the keyboard focus _DebugPrint("$LBN_SETFOCUS" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value EndSwitch EndSwitch ; Proceed the default AutoIt3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default AutoIt3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _DebugPrint($s_Text) $s_Text = StringReplace($s_Text, @CRLF, @CRLF & "-->") ConsoleWrite("!===========================================================" & @CRLF & _ "+===========================================================" & @CRLF & _ "-->" & $s_Text & @CRLF & _ "+===========================================================" & @CRLF) EndFunc ;==>_DebugPrint Link to comment Share on other sites More sharing options...
Terenz Posted June 12, 2016 Share Posted June 12, 2016 (edited) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Form1", 300, 150, -1, -1) $fENTER = GUICtrlCreateDummy() $fBACKSPACE = GUICtrlCreateDummy() $sEdit = GUICtrlCreateEdit("", 10, 10, 100, 100) Local $aAccelKeys[2][2] = [["{ENTER}", $fENTER],["{BACKSPACE}", $fBACKSPACE]] GUISetAccelerators($aAccelKeys) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $fENTER ConsoleWrite("ENTER" & @CRLF) _EnableKey("{ENTER}") Case $fBACKSPACE ConsoleWrite("BACKSPACE" & @CRLF) _EnableKey("{BACKSPACE}") EndSwitch WEnd Func _EnableKey($sKey) GUISetAccelerators("") ControlSend($hGUI, "", ControlGetFocus($hGUI, ""), $sKey) GUISetAccelerators($aAccelKeys) EndFunc ;==>_EnableKey Alternative to _IsPressed Edited June 12, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
kcvinu Posted June 12, 2016 Share Posted June 12, 2016 (edited) @Terenz , Your idea will block the enter key and backspace for other controls in that form. Edited June 12, 2016 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Terenz Posted June 12, 2016 Share Posted June 12, 2016 kcvinu, You have right, i have edit it for resolve that problem kcvinu 1 Nothing is so strong as gentleness. Nothing is so gentle as real strength 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