jugador Posted September 28, 2019 Share Posted September 28, 2019 (edited) 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. 1,John,Good 2,Ben,Bad 3,David,Bad 5,Kevin,Good no clue how to code this and please don’t use dll otherwise problematic for me to understand and modified this code for later use. Edited September 28, 2019 by jugador Link to comment Share on other sites More sharing options...
BugFix Posted September 28, 2019 Share Posted September 28, 2019 (edited) 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: expandcollapse popup#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) ] GUISetState() GUIRegisterMsg($WM_NOTIFY, "MY_NOTIFY") ; 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 Exit EndSwitch WEnd 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) EndSwitch EndSwitch Return $GUI_RUNDEFMSG 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)] Select Case $aNow[2] = '' And $aNow[3] = '' ; do nothing Return Case $aNow[2] = 'x' And $aNow[3] = '' $indexRepl = 0 Case $aNow[2] = '' And $aNow[3] = 'x' $indexRepl = 1 EndSelect _GUICtrlListView_SetItemText($hListView, $_index, $aReplace[$indexRepl][0], 2) _GUICtrlListView_SetItemText($hListView, $_index, $aReplace[$indexRepl][1], 3) EndFunc Edited September 28, 2019 by BugFix jugador 1 Best Regards BugFix Link to comment Share on other sites More sharing options...
jugador Posted September 29, 2019 Author Share Posted September 29, 2019 (edited) @BugFix 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 September 29, 2019 by jugador 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