Jump to content
Sign in to follow this  

Gui Detect multiple click

Recommended Posts

Need help


Gui Structure   
Via loop create            
    ID & Name :- GUICtrlCreateListView        
    Good & Bad button:- GUICtrlCreateRadio        
Logic Part             
via loop check if Good button click then Bad Button disable or vice versa            
store result output_Array[6][4]            
above example Output (Msgbox)            
if neither of the button (Good / Bad) is selected then skip that Row.        
no clue how to code this  :sweating:
and please don’t use dll otherwise problematic for me to understand and modified this code for later use.

Edited by jugador

Share this post

Link to post
Share on other sites

The logic for radio button is, that one of a radio button in a group must checked. If you want to allow that all buttons are unchecked, use checkboxes instead.

But imo you can have only one checkbox in an listview item with default controls. May be its possible to change this behaviour, but i think, this needs a lot of effort. 


But you can use instead the checkboxes "x" for checked and "" for unchecked.

Here an example:

#include <WindowsConstants.au3>
#include <GUIListView.au3>

Global $hGui = GUICreate('Test')
Global $idListview = GuiCtrlCreateListView('ID|Name|Good|Bad', 10, 10, 200, 150)
Global $hListView = GUICtrlGetHandle($idListview)
Global $aItem[] = [ _
GUICtrlCreateListViewItem('1|John|x|', $idListview), _
GUICtrlCreateListViewItem('2|Ben||x', $idListview), _
GUICtrlCreateListViewItem('3|David||x|', $idListview), _
GUICtrlCreateListViewItem('4|Michelle||', $idListview), _
GUICtrlCreateListViewItem('5|Kevin|x|', $idListview), _
GUICtrlCreateListViewItem('6|Andy||', $idListview) ]


; with left click in colum (good/bad) you change the value vice versa if good or bad are set
; with right click you can set good/bad at first time

While True
    Switch GUIGetMsg()
        Case -3

Func MY_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
    $hWndListView = $hListView
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
            Local $iIndex = DllStructGetData($tInfo, "Index")
            Local $iIndexSub = DllStructGetData($tInfo, "SubItem")
            Switch $iCode
                Case $NM_CLICK
                    _SwitchGoodBad($iIndex, $iIndexSub)
                Case $NM_RCLICK
                    If _GUICtrlListView_GetItemText($hListView, $iIndex, 2) = '' And _
                       _GUICtrlListView_GetItemText($hListView, $iIndex, 3) = '' Then _
                       _GUICtrlListView_SetItemText($hListView, $iIndex, 'x', $iIndexSub)
EndFunc   ;==>WM_NOTIFY

Func _SwitchGoodBad($_index, $_index_sub)
    Local Static $aReplace[2][2] = [['','x'],['x','']]
    Local $indexRepl
    Local $aNow[] = ['','',_GUICtrlListView_GetItemText($hListView, $_index, 2),_GUICtrlListView_GetItemText($hListView, $_index, 3)]
        Case $aNow[2] = '' And $aNow[3] = ''
            ; do nothing
        Case $aNow[2] = 'x' And $aNow[3] = ''
            $indexRepl = 0
        Case $aNow[2] = '' And $aNow[3] = 'x'
            $indexRepl = 1
    _GUICtrlListView_SetItemText($hListView, $_index, $aReplace[$indexRepl][0], 2)
    _GUICtrlListView_SetItemText($hListView, $_index, $aReplace[$indexRepl][1], 3)


Edited by BugFix

Best Regards BugFix  

Share this post

Link to post
Share on other sites


Button or checkbox not a problem but the logic should be you can’t click both(Good/Bad) of the same row

& user input so no predefine marking using listview.

Edited by jugador

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...