Jump to content

detect full row selected by checkbox in listview !


Recommended Posts

hello everybody 

I use this functions to detect checkbox item in list view if checked or not 
 

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) 
    Global $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
    $hWndListView = $listview_cat
    If Not IsHWnd($listview_cat) Then $hWndListView = GUICtrlGetHandle($listview_cat)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")

    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_CLICK, $NM_DBLCLK, $NM_RCLICK, $NM_RDBLCLK
                    Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    Local $iIndex = DllStructGetData($tInfo, "Index")

                    If $iIndex <> -1 Then
                        Local $iX = DllStructGetData($tInfo, "X")
                        Local $iPart = 1
                        If _GUICtrlListView_GetView($listview_cat) = 1 Then $iPart = 2 ;for large icons view

                        Local $aIconRect = _GUICtrlListView_GetItemRect($listview_cat, $iIndex, $iPart)

                        If $iX < $aIconRect[0] And $iX >= 5 Then
                            ItemChecked_Proc(_GUICtrlListView_GetItemText($listview_cat, $iIndex), _
                                _GUICtrlListView_GetItemChecked($listview_cat, $iIndex) = 0)
                            Return 0
                        EndIf
                    EndIf
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc


Func ItemChecked_Proc($iItem, $sState)
    _GUICtrlStatusBar_SetText ($hStatusbar0 ,"<" & $iItem & "> is checked = " & $sState ,0)
EndFunc


the iItem detected is in first column only in $listview_cat

I need to detect full row (all columns) 

help me please 

Edited by AlienStar
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...