Jump to content

Need help with WM_Notify in Listview and Input


Recommended Posts

Hello

I'm making a GUI that needs WM_Notify to work as I want to. Now my WM_Notify is enabling and disabling input and button in my GUI if there is enough characters in the string but I also want it to detect when the user clicks one of the rows in the ListView.

Here is the working WM_Notify script im using (>Thanks to Martin is this topic)

Func GUI_WM_COMMAND($hWnd, $imsg, $iwParam, $ilParam)
Local $setHK = False
$nNotifyCode = BitShift($iwParam, 16)
$nID = BitAND($iwParam, 0x0000FFFF)
$hCtrl = $ilParam

If $nNotifyCode = $EN_CHANGE Then
            Select

                Case $hCtrl = GUICtrlGetHandle($InputDellOnSiteRepairID)
                If Stringlen(GUICtrlRead($InputDellOnSiteRepairID)) = 11 Then
GUICtrlSetState($InputSak, $GUI_ENABLE)
                GUICtrlSetState($ButtonFindCase, $GUI_ENABLE)
Else
GUICtrlSetState($InputSak, $GUI_DISABLE)
                GUICtrlSetState($ButtonFindCase, $GUI_DISABLE)
EndIf

;------------------

                Case $hCtrl = GUICtrlGetHandle($InputSak)
                If Stringlen(GUICtrlRead($InputSak)) = 5 Then
GUICtrlSetState($ButtonAdd, $GUI_ENABLE)
Else
GUICtrlSetState($ButtonAdd, $GUI_DISABLE)
EndIf


            EndSelect
        EndIf
Return $GUI_RUNDEFMSG


EndFunc

Is there any way i can merge my script with this? :)

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tagNMHDR, $event, $hwndFrom, $code
$tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code)
If @error Then Return
$event = DllStructGetData($tagNMHDR, 3)
Select
Case $wParam = $ListView
Select
; Case $event = $NM_CLICK
; ConsoleWrite("SingleClick" & @LF)
Case $event = $NM_DBLCLK
$editsqlquery = 1
;Setup GLOBAL variables rather than calling functions this part need to exit as fast as possible
EndSelect
EndSelect
$tagNMHDR = 0
$event = 0
$lParam = 0
EndFunc ;==>WM_Notify_Events

>Source

Edited by Chris86
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...