supersonic Posted June 24, 2010 Share Posted June 24, 2010 Hi! Here's the sample code: expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <ListviewConstants.au3> Global $hGUI = GUICreate("TEST", 300, 102, -1, -1) Global $hGUI_LV = GUICtrlCreateListView("Column1|Column2|Column3", 1, 1, 298, 73, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) Global $hGUI_B = GUICtrlCreateButton("START", 1, 76, 298, 25) GUISetState(@SW_SHOW, $hGUI) While 1 Local $msg = GUIGetMsg(1) Switch $msg[1] Case $hGUI Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $hGUI_B _GUICtrlListView_DeleteAllItems($hGUI_LV) GUICtrlSetState($hGUI_LV, $GUI_DISABLE) Local $iTmp = 0 For $i = 97 To 122 Local $sTmp = Chr($i) GUICtrlCreateListViewItem($sTmp & "1|" & $sTmp & "2|" & $sTmp & "3", $hGUI_LV) GUICtrlSendMsg($hGUI_LV, $LVM_ENSUREVISIBLE, $iTmp, 0) Sleep(250) $iTmp += 1 Next GUICtrlSetState($hGUI_LV, $GUI_ENABLE) EndSwitch EndSwitch WEnd GUIDelete($hGUI) I'm trying to disable unchecking of checkboxes in a ListView while processing. Using '$GUI_DISABLE' works and still let's the ListView auto-scoll using 'GUICtrlSendMsg()'. But how to avoid unchecking AND keeping the ListView manually scrollable? '$GUI_DISABLE' disables manual scrolling... Anyone any ideas? Greets, -supersonic. Link to comment Share on other sites More sharing options...
KaFu Posted June 24, 2010 Share Posted June 24, 2010 Hmmm , maybe catch the click via wm_command and force the checkbox state by _GUICtrlListView_SetItemChecked()? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Bert Posted June 24, 2010 Share Posted June 24, 2010 (edited) MrCreatoR came up with this. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> Global $aLV_Disabled_Items[1][2] $hGUI = GUICreate("_GUICtrlListView_AddDisabledItem Demo", 400, 200, -1, -1) $nListView = GUICtrlCreateListView("Column1|Column2|Column3", 10, 10, 380, 180, $LVS_SHOWSELALWAYS, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) $hListView = GUICtrlGetHandle($nListView) $nLV_Item1 = GUICtrlCreateListViewItem("1|2|3", $nListView) $nLV_Item2 = GUICtrlCreateListViewItem("4|5|6", $nListView) $nLV_Item3 = GUICtrlCreateListViewItem("7|8|9", $nListView) _GUICtrlListView_AddDisabledItem($hListView, 1) GUIRegisterMsg($WM_NOTIFY, "__WM_NOTIFY") GUISetState(@SW_SHOW, $hGUI) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GUICtrlListView_AddDisabledItem($hListView, $iItemIndex) $aLV_Disabled_Items[0][0] += 1 ReDim $aLV_Disabled_Items[$aLV_Disabled_Items[0][0]+1][2] $aLV_Disabled_Items[$aLV_Disabled_Items[0][0]][0] = $hListView $aLV_Disabled_Items[$aLV_Disabled_Items[0][0]][1] = $iItemIndex _GUICtrlListView_SetItemState($hListView, $iItemIndex, $LVIS_CUT, $LVIS_CUT) EndFunc Func __WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $nListView If Not IsHWnd($nListView) Then $hWndListView = GUICtrlGetHandle($nListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_BEGINDRAG, $LVN_ITEMCHANGING Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) Local $iItem = DllStructGetData($tInfo, "Item") For $i = 1 To $aLV_Disabled_Items[0][0] If $hWndListView = $aLV_Disabled_Items[$i][0] And $iItem = $aLV_Disabled_Items[$i][1] Then Return 1 EndIf Next EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Edited June 24, 2010 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
supersonic Posted June 25, 2010 Author Share Posted June 25, 2010 @Volly @MrCreatoR Thank you! I thought about that, too... But wasn't sure how to realize. 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