Moderators Melba23 Posted September 8, 2021 Author Moderators Posted September 8, 2021 NassauSky, Good fun getting that to work: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiMenu.au3> #Include "GUIListViewEx.au3" Opt("GUIOnEventMode", 1) Global Enum $iThis = 1000, $iThat Global $fRightClick = False, $aHit, $fUDF = False ; Create GUI $hGUI = GUICreate("ContextMenu NATIVE vs UDF", 640, 510) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ;--------------------------------------------------LEFT NATIVE SETUP-------------------------------------------------------------------------- $cListView_Left = GUICtrlCreateListView("", 30, 40, 200, 300, BitOR($LVS_DEFAULT, $WS_BORDER)) _GUICtrlListView_AddColumn($cListView_Left, "Column 1", 83) _GUICtrlListView_AddColumn($cListView_Left, "Column 2", 83) $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, "", 0, 0, True) $ContextMenu = GUICtrlCreateContextMenu($cListView_Left) GUICtrlCreateMenuItem("Run This", $ContextMenu, 1) GUICtrlSetOnEvent(-1, "_myRoutine1") GUICtrlCreateMenuItem("Run That", $ContextMenu, 2) GUICtrlSetOnEvent(-1, "_myRoutine2") ;-------------------------------------------------RIGHT UDF SETUP------------------------------------------------------------------------------ $hListView_Right = _GUICtrlListView_Create($hGUI, "", 330, 40, 200, 300, BitOR($LVS_DEFAULT, $WS_BORDER)) ;UDF version _GUICtrlListView_AddColumn($hListView_Right, "Column 1", 83) _GUICtrlListView_AddColumn($hListView_Right, "Column 2", 83) $iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, "", 0, 0, True) _GUIListViewEx_MsgRegister(False) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState() ;-------------------------------------------------COMMON ITEM INSERTION------------------------------------------------------------------------- _GUIListViewEx_InsertSpec($iLV_Left_Index, 0, "Row 1a Manual Wait| Test 1b") _GUIListViewEx_InsertSpec($iLV_Left_Index, 1, "Row 2a Manual Wait| Test 2b") _GUIListViewEx_InsertSpec($iLV_Right_Index, 0, "Row 1a Manual Wait| Test 1b") _GUIListViewEx_InsertSpec($iLV_Right_Index, 1, "Row 2a Manual Wait| Test 2b") While 1 Sleep(10) WEnd Func _Exit() Exit EndFunc Func _myRoutine1() If $fUDF Then MsgBox($MB_SYSTEMMODAL, "RClick", "Running This" & @CRLF & $aHit[0] & "-" & $aHit[1]) $fUDF = False Else $aContext =_GUIListViewEx_ContextPos() MsgBox($MB_SYSTEMMODAL, "RClick", "Running This" & @CRLF & $aContext[1] & "-" & $aContext[2]) EndIf EndFunc Func _myRoutine2() If $fUDF Then MsgBox($MB_SYSTEMMODAL, "RClick", "Running That" & @CRLF & $aHit[0] & "-" & $aHit[1]) $fUDF = False Else $aContext =_GUIListViewEx_ContextPos() MsgBox($MB_SYSTEMMODAL, "RClick", "Running That" & @CRLF & $aContext[1] & "-" & $aContext[2]) EndIf EndFunc Func _LV_Right_RClick() ; Called inside _WM_NOTIFY $aHit = _GUICtrlListView_SubItemHitTest($hListView_Right) If $aHit[0] <> -1 Then $fUDF = True ; Click on UDF ListView $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Run This", $iThis) _GUICtrlMenu_AddMenuItem($hMenu, "Run That", $iThat) Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hListView_Right, -1, -1, 1, 1, 2) Case $iThis _myRoutine1() Case $iThat _myRoutine2() EndSwitch _GUICtrlMenu_DestroyMenu($hMenu) EndIf EndFunc Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView_Right Switch $iCode Case $NM_RCLICK _LV_Right_RClick() Return 0 EndSwitch EndSwitch _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>WM_NOTIFY All good now? M23 NassauSky 1  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Â
NassauSky Posted September 8, 2021 Posted September 8, 2021 @Melba23 When you say 'good fun' did you mean that took you 120 seconds to modify 😕 Sheesh OK it's outside the message handler but you have some other fun stuff going on. I'll have to play with.  Thanks!
Mabus Posted September 10, 2021 Posted September 10, 2021 (edited) Hello all, sorry for stupid question... I channge color row by GUICtrlSetBkColor and change text cells by _GUICtrlListView_SetItemText all ok! BUT AFTER SORTING or draging ALL CHANGES LOST! WHY???????????? T_T  P.S. Also i need add "open window" event after double click on row... and for work features sort and drag and my event i need rewrite  _GUIListViewEx_WM_NOTIFY_Handler just for catch  $LVN_ITEMACTIVATE o_O????? Edited September 10, 2021 by Mabus
Moderators Melba23 Posted September 10, 2021 Author Moderators Posted September 10, 2021 Mabus, Welcome to the AutoIt forums. With regard to the colours, at a guess you are not calling the _EventMonitor function in your idle loop - but as you post no code I cannot be more specific. As to the "open window" event on a double click, you can use the _SetEditStatus function with $iMode = 9 to define a function to run. So, post a short example of what you are trying to do (see here how to do it) and I will try and help yo to get it running correctly. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Â
Mabus Posted September 13, 2021 Posted September 13, 2021 (edited) Ok maybe later i try it... ))) I so stupid and make all himself for now. (all work well) After my power go low i will try use _Ex again... =)))) Anyway thanks for help! ^_^ Edited September 13, 2021 by Mabus
Moderators Melba23 Posted September 13, 2021 Author Moderators Posted September 13, 2021 [NEW VERSION] - 13 Sep 21 Changed: - A small change to the $iAdded parameter value of 512 - this used to block ALL drag/drop operations, but now only blocks INTERNAL drag/drop. So to block ALL drag/drop operations with this version you will now need to use an $iAdded value of 64+128+512. This is a script-breaking change if you use this functionality - although the change to your scripts to maintain it is not too taxing! Fixed: - A bug in the _Close function when there were multiple ListViews being closed. New version in the zip in the first post. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Â
jimmy123j Posted December 29, 2021 Posted December 29, 2021 (edited) So for bother, does ListviewEX support multiple selection !? 'cause I enable the _GUIListViewEx_Init function and all of my listview multiple selection functions are not responsing such like _GUICtrlListView_GetSelectedIndices and multiple select ... Edited December 29, 2021 by jimmy123j
Moderators Melba23 Posted December 29, 2021 Author Moderators Posted December 29, 2021 jimmy123j, Multiple selections are available within the UDF, unless you get into the more exotic scenarios such as colouring the cells or having single cell selection. As these options require he ListView to be user-drawn rather then run by Windows, the standard selection no longer works - hence the need for functions within the UDF such as  _GUIListViewEx_GetLastSelItem. Please post the code you are using and I will see if there is anything I can do to help. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Â
jimmy123j Posted December 29, 2021 Posted December 29, 2021 (edited) 54 minutes ago, Melba23 said: jimmy123j, Multiple selections are available within the UDF, unless you get into the more exotic scenarios such as colouring the cells or having single cell selection. As these options require he ListView to be user-drawn rather then run by Windows, the standard selection no longer works - hence the need for functions within the UDF such as  _GUIListViewEx_GetLastSelItem. Please post the code you are using and I will see if there is anything I can do to help. M23 Thanks for reply, 'cause PIP i can't upload my script, really sorry and I remove the color feature, multiple selection is work, but unfortunately I need the cell color item and multiple selection same time LarsJ's listview color can help my script this time, thanks again   Edited December 29, 2021 by jimmy123j
Moderators Melba23 Posted December 29, 2021 Author Moderators Posted December 29, 2021 jimmy123j, No problem. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Â
Champak Posted March 29, 2022 Posted March 29, 2022 (edited) Hi, I'm trying to incorporate the following listview group function with combobox listviews, but the groups wont show. No errors or anything, the group just doesn't display. I need to be able to hide rows when needed. Is it not compatible? Thanks. $l = 1 $m = 4 $n = 0 $sID_1 = 1 $sID_2 = 2 $sIndex_1 = 0 For $i = 0 To 4 _GUICtrlListView_InsertGroup($cLV_1, -1, $sID_1, "") _GUICtrlListView_SetGroupInfo ( $cLV_1, $sID_1, "", 0, $LVGS_NOHEADER ) GUICtrlCreateListViewItem("",$cLV_1) _GUICtrlListView_SetItemGroupID($cLV_1, $sIndex_1, $sID_1) _GUICtrlListView_InsertGroup($cLV_1, -1, $sID_2, "") _GUICtrlListView_SetGroupInfo ( $cLV_1, $sID_2, "", 0, $LVGS_COLLAPSIBLE + $LVGS_COLLAPSED ) For $sIndex_2 = $l To $m GUICtrlCreateListViewItem("",$cLV_1) _GUICtrlListView_SetItemGroupID($cLV_1, $sIndex_2, $sID_2) $n += 1 next $l += 5 $m += 5 $n += 1 $sID_1 += 2 $sID_2 += 2 $sIndex_1 += 5 Next  Edited March 29, 2022 by Champak
Moderators Melba23 Posted March 29, 2022 Author Moderators Posted March 29, 2022 Champak, Sorry, this UDF is not compatible with ListView groups. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Â
Champak Posted March 30, 2022 Posted March 30, 2022 OK, thanks, hopefully an upgrade for groups is in sights for the future...😉  Second issue, why is this not working? expandcollapse popup#Include "GUIListViewEx.au3" #include <Excel.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> ; Create GUI $hGUI = GUICreate("LVEx Example 1", 940, 510) Global $aLVArray_1[20][40] Global $cLV_1 = GUICtrlCreateListView("blah", 10, 30, 980, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) ;Global $cLV_1 = _GUICtrlListView_Create($hGUI, "", 10, 40, 900, 300, BitOR($LVS_DEFAULT, $WS_BORDER)) ;UDF version _GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_GRIDLINES));$LVS_EX_ONECLICKACTIVATE _GUICtrlListView_AddColumn($cLV_1, "Column 1", 83) _GUICtrlListView_AddColumn($cLV_1, "Column 2", 83) ;GUICtrlCreateListViewItem("ttt", $cLV_1) $iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 0, 0, True, 1 + 8 + 32) ; + 16 _GUIListViewEx_InsertSpec($iLVIndex_1, 0, $aLVArray_1);<--------------This is what causes the error _GUIListViewEx_SetEditStatus($iLVIndex_1, 0) ; Default = standard text edit _GUIListViewEx_SetEditStatus($iLVIndex_1, 1) ; Default = standard text edit _GUIListViewEx_MsgRegister() GUISetState() While 1 Sleep(50) WEnd Inserting an array is causing the error below. But I believe I'm adding it correctly. Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If StringInStr(($aGLVEx_Data[0][13])[$iItem + 1][$iSubItem], ";") Then If StringInStr(($aGLVEx_Data[0][13]^ ERROR Thanks.
Champak Posted March 30, 2022 Posted March 30, 2022 Also, this doesn't work as expected? To set different combo box content based on the reading of another combo box. Â If _GUICtrlListView_GetItemText ( $cLV_1, $sListRow, 6) = "Boys" Then ConsoleWrite("++" & @CRLF) $sCat3Level1 = "A|B|C|D" $sCat3Level2 = "E|F|G|H" $sAtt_Gender = "Alphabet" $iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 1, 0, True);<--Works ONCE when this is removed _GUIListViewEx_SetEditStatus($iLVIndex_1, 7, 2, $sCat3Level1, True) ; 2 = Read-only combo _GUIListViewEx_SetEditStatus($iLVIndex_1, 8, 2, $sCat3Level2, True) ; 2 = Read-only combo _GUIListViewEx_SetEditStatus($iLVIndex_1, 14, 2, $sAtt_Gender, True) ; 2 = Read-only combo Else ConsoleWrite("!!" & @CRLF) $sCat3Level11 = "1|2|3|4" $sCat3Level21 = "5|6|7|8" $sAtt_Gender1 = "Numbers" $iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 1, 0, True);<--wworks ONCE when this is removed _GUIListViewEx_SetEditStatus($iLVIndex_1, 7, 2, $sCat3Level11, True) ; 2 = Read-only combo _GUIListViewEx_SetEditStatus($iLVIndex_1, 8, 2, $sCat3Level21, True) ; 2 = Read-only combo _GUIListViewEx_SetEditStatus($iLVIndex_1, 14, 2, $sAtt_Gender1, True) ; 2 = Read-only combo EndIf It will work ONCE when when "$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 1, 0, True)" is removed from the code. What am I doing wrong?
Moderators Melba23 Posted March 31, 2022 Author Moderators Posted March 31, 2022 (edited) Champak, Sorry for the delay in replying - looking after my grandchildren for the day does not leave a lot of time for anything else! Quote hopefully an upgrade for groups is in sights for the future Not a hope, sorry! Solution to first problem - look for the ############ delineated sections: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include "GUIListViewEx_Test.au3" #include <Array.au3> ; Create GUI $hGUI = GUICreate("LVEx Example 1", 940, 510) ; Simulate data array and fill to show it fits Global $aLVArray_1[20][40] For $i = 0 to 19 For $j = 0 To 39 $aLVArray_1[$i][$j] = $i & " - " & $j Next Next ;_ArrayDisplay($aLVArray_1, "", Default, 8) ; Just to see that you have the array correctly sized Global $cLV_1 = GUICtrlCreateListView("blah", 10, 30, 920, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_GRIDLINES));$LVS_EX_ONECLICKACTIVATE ; Solution 1 to your problem #################################################################### ; Add columns to match the size of the data array you want to add - you already have 1 so need to add 39 For $i = 0 To 38 _GUICtrlListView_AddColumn($cLV_1, "Col " & $i, 30) Next ; ############################################################################################### $iLVIndex_1 = _GUIListViewEx_Init($cLV_1, "", 0, 0, True, 1 + 8 + 32) ; + 16 ;_GUIListViewEx_SetEditStatus($iLVIndex_1, 0) ; Default = standard text edit ;_GUIListViewEx_SetEditStatus($iLVIndex_1, 1) ; Default = standard text edit ; Insert the data $aRet = _GUIListViewEx_InsertSpec($iLVIndex_1, 0, $aLVArray_1) ; Solution 2 to your problem #################################################################### ; You initiated to UDF to have colour, so you need to tell it what colours to use (all default in this case) Global $aLVCol_1[20][40] $iRet = _GUIListViewEx_LoadColour($iLVIndex_1, $aLVCol_1) ; ############################################################################################### _GUIListViewEx_MsgRegister() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd You were getting lots of error returns from the various UDF functions, all explained in the function headers, which helped me to see what was going wrong. Always worth checking these values when problems occur. And now to the second problem: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include "GUIListViewEx_Test.au3" #include <Array.au3> ; Create GUI $hGUI = GUICreate("LVEx Example 1", 940, 510) ; Simulate data array and fill to show it fits Global $aLVArray_1[20][40] For $i = 0 to 19 For $j = 0 To 39 $aLVArray_1[$i][$j] = $i & " - " & $j Next Next ;_ArrayDisplay($aLVArray_1, "", Default, 8) ; Just to see that you have the array correctly sized Global $cLV_1 = GUICtrlCreateListView("blah", 10, 30, 920, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_GRIDLINES));$LVS_EX_ONECLICKACTIVATE ; Solution 1 to your problem #################################################################### ; Add columns to match the size of the data array you want to add - you already have 1 so need to add 39 For $i = 0 To 38 _GUICtrlListView_AddColumn($cLV_1, "Col " & $i + 1, 30) Next $cBoys = GUICtrlCreateButton("Boys", 10, 300, 80, 30) $cGirls = GUICtrlCreateButton("Girls", 120, 300, 80, 30) ; ############################################################################################### $iLVIndex_1 = _GUIListViewEx_Init($cLV_1, "", 0, 0, True, 1 + 8 + 32) ; + 16 _GUIListViewEx_SetEditStatus($iLVIndex_1, 0) ; Default = standard text edit _GUIListViewEx_SetEditStatus($iLVIndex_1, 1) ; Default = standard text edit ; Insert the data $aRet = _GUIListViewEx_InsertSpec($iLVIndex_1, 0, $aLVArray_1) ; Solution 2 to your problem #################################################################### ; You initiated to UDF to have colour, so you need to tell it what colours to use (all default in this case) Global $aLVCol_1[20][40] $iRet = _GUIListViewEx_LoadColour($iLVIndex_1, $aLVCol_1) ; ############################################################################################### _GUIListViewEx_MsgRegister() GUISetState() ; Set specific values for second test _GUIListViewEx_ChangeItem($iLVIndex_1, 5, 6, "Boys") _GUIListViewEx_ChangeItem($iLVIndex_1, 7, 6, "Girls") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cBoys _Boys(5) Case $cGirls _Boys(7) EndSwitch _GUIListViewEx_EventMonitor() WEnd Func _Boys($iRow = 5) If _GUICtrlListView_GetItemText($cLV_1, $iRow, 6) = "Boys" Then ConsoleWrite("++" & @CRLF) $sCat3Level1 = "A|B|C|D" $sCat3Level2 = "E|F|G|H" $sAtt_Gender = "Alphabet" ; Mode: 2 = combo ; Param2: 1 = read-only & 2 = auto dropdown _GUIListViewEx_SetEditStatus($iLVIndex_1, 7, 2, $sCat3Level1, 1 + 2) _GUIListViewEx_SetEditStatus($iLVIndex_1, 8, 2, $sCat3Level2, 1 + 2) _GUIListViewEx_SetEditStatus($iLVIndex_1, 14, 2, $sAtt_Gender, 1 + 2) Else ConsoleWrite("!!" & @CRLF) $sCat3Level11 = "1|2|3|4" $sCat3Level21 = "5|6|7|8" $sAtt_Gender1 = "Numbers" _GUIListViewEx_SetEditStatus($iLVIndex_1, 7, 2, $sCat3Level11, 1 + 2) _GUIListViewEx_SetEditStatus($iLVIndex_1, 8, 2, $sCat3Level21, 1 + 2) _GUIListViewEx_SetEditStatus($iLVIndex_1, 14, 2, $sAtt_Gender1, 1 + 2) EndIf EndFunc That works perfectly for me. It does help if you use the correct syntax for the function calls: - Mode 2 simply means combo - you need to set the type of combo in Param2 - as shown. - So where did the "True" you were using in Param2 come from? M23 Edited March 31, 2022 by Melba23 Added comments for second problem  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Â
Champak Posted April 2, 2022 Posted April 2, 2022 First issue: It is working ok now. Have another issue with it that I'm dealing with and trying to figure out, but it's ok for now. It's crazy, I got to say, this is a great UDF, but the hardest I've worked with. Second issue: I don't understand, the "True" parameter came from your example6 included in your download. And as I see it, "True" would represent "1" so there is no issue using it. And it is actually working for me elsewhere in this script. Either way, it is working great now. Thanks for the help.
Moderators Melba23 Posted April 2, 2022 Author Moderators Posted April 2, 2022 (edited) Champak, Quote I got to say, this is a great UDF, but the hardest I've worked with. And by far the hardest I have ever written - which is why new feature requests are very unlikely to be developed! M23 Edit: I remember where the "True" comes from in that example. There used to be only 2 options for that parameter (normal or read-only) but I added another option to auto-drop the combo. So now you need to use 0/1 [+ 2] - as explained in the function header. I will amend the example for the next release. Edited April 2, 2022 by Melba23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Â
Champak Posted April 5, 2022 Posted April 5, 2022 I'm going insane here. Past 2 days been fiddling around trying to accomplish my last issue (I think it's my last) and can't make any headway. How do I load a new array into the listview from a function after one was originally loaded on the app launch? I keep getting array dimension exceeded...same amount of columns. I tried deleting the control and recreating it (exactly how it was created the first time). I tried deleting the listview contents and rebuilding. I tried simply inserting a new array. I tried zeroing out all the arrays and inserting a new one. I tried things I know shouldn't work but throwing anything against the wall. I just can't figure this thing. expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include "GUIListViewEx.au3" #include <Array.au3> ; Create GUI $hGUI = GUICreate("LVEx Example 1", 940, 510) ; Simulate data array and fill to show it fits Global $aLVArray_1[20][40] For $i = 0 to 19 For $j = 0 To 39 $aLVArray_1[$i][$j] = $i & " - " & $j Next Next ;_ArrayDisplay($aLVArray_1, "", Default, 8) ; Just to see that you have the array correctly sized Global $cLV_1 = GUICtrlCreateListView("blah", 10, 30, 920, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_GRIDLINES));$LVS_EX_ONECLICKACTIVATE ; Solution 1 to your problem #################################################################### ; Add columns to match the size of the data array you want to add - you already have 1 so need to add 39 For $i = 0 To 38 _GUICtrlListView_AddColumn($cLV_1, "Col " & $i, 30) Next ; ############################################################################################### $iLVIndex_1 = _GUIListViewEx_Init($cLV_1, "", 0, 0, True, 1 + 8 + 32) ; + 16 ;_GUIListViewEx_SetEditStatus($iLVIndex_1, 0) ; Default = standard text edit ;_GUIListViewEx_SetEditStatus($iLVIndex_1, 1) ; Default = standard text edit ; Insert the data $aRet = _GUIListViewEx_InsertSpec($iLVIndex_1, 0, $aLVArray_1) ; Solution 2 to your problem #################################################################### ; You initiated to UDF to have colour, so you need to tell it what colours to use (all default in this case) Global $aLVCol_1[20][40] $iRet = _GUIListViewEx_LoadColour($iLVIndex_1, $aLVCol_1) ; ############################################################################################### _GUIListViewEx_MsgRegister() GUISetState() Sleep(5000) Global $aBVArray_1[90][40] For $i = 0 to 19 For $j = 0 To 39 $aBVArray_1[$i][$j] = $i & " a- " & $j Next Next $iLVIndex_1 = _GUIListViewEx_Init($cLV_1, "", 0, 0, True, 1 + 8 + 32) ; + 16 ; Insert the data $aRet = _GUIListViewEx_InsertSpec($iLVIndex_1, 0, $aBVArray_1) ; Solution 2 to your problem #################################################################### ; You initiated to UDF to have colour, so you need to tell it what colours to use (all default in this case) Global $aLVCol_1[90][40] $iRet = _GUIListViewEx_LoadColour($iLVIndex_1, $aLVCol_1) ; ############################################################################################### _GUIListViewEx_MsgRegister() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  Here's a basic example of what I've tried, once I scroll down to the bottom...as with the other versions I've tried...is when it errors out.
Moderators Melba23 Posted April 5, 2022 Author Moderators Posted April 5, 2022 Champak, You have tried to do something that to my knowledge has never been done before - and of course it fails! But I know why. To correctly empty and then reload the ListView you need to follow the instructions in the "Guide" that is part of the download (you did read it?): Quote If you wish to reload the ListView with new data, you will need to clear the current content using _GUICtrlListView_DeleteAllItems, close it within the UDF using _GUIListViewEx_Close, reload the ListView with the new data and then reinitialise it using _GUIListViewEx_Init. Otherwise the UDF will become confused about the current content and errors will certainly occur. But you have colour enabled - and If the ListView has colour enabled, it usually loads the colour before the WM_NOTIFY message is registered. But you are trying to reload an existing ListView with the WM_NOTIFY message previously registered. So it looks as if we need to UNregister the message, load the colours and then REregister the message - when we do that everything works as expected: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include "GUIListViewEx_Test.au3" #include <Array.au3> ; Create GUI $hGUI = GUICreate("LVEx Example 1", 940, 510) ; Simulate data array and fill to show it fits Global $aLVArray_1[20][40] For $i = 0 to 19 For $j = 0 To 39 $aLVArray_1[$i][$j] = $i & " - " & $j Next Next Global $cLV_1 = GUICtrlCreateListView("blah", 10, 30, 920, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_GRIDLINES));$LVS_EX_ONECLICKACTIVATE ; Add columns to match the size of the data array you want to add - you already have 1 so need to add 39 For $i = 0 To 38 _GUICtrlListView_AddColumn($cLV_1, "Col " & $i, 30) Next $iLVIndex_1 = _GUIListViewEx_Init($cLV_1, "", 0, 0, True, 1 + 8 + 32) ; + 16 ; Insert the data $aRet = _GUIListViewEx_InsertSpec($iLVIndex_1, 0, $aLVArray_1) ; You initiated to UDF to have colour, so you need to tell it what colours to use (all default in this case) Global $aLVCol_1[20][40] $iRet = _GUIListViewEx_LoadColour($iLVIndex_1, $aLVCol_1) _GUIListViewEx_MsgRegister() GUISetState() Sleep(1000) Global $aBVArray_1[90][40] For $i = 0 to 89 For $j = 0 To 39 $aBVArray_1[$i][$j] = $i & " a- " & $j Next Next ; Correctly clear and reload the ListView ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Close current ListView in the UDF _GUIListViewEx_Close($iLVIndex_1) ; Delete current contant _GUICtrlListView_DeleteAllItems($cLV_1) ; UNregister WM_NOTIFY ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUIRegisterMsg(0x004E, "") ; Reinitialise the ListView $iLVIndex_1 = _GUIListViewEx_Init($cLV_1, "", 0, 0, True, 1 + 8 + 32) ; + 16 ; Insert the data $aRet = _GUIListViewEx_InsertSpec($iLVIndex_1, 0, $aBVArray_1) ; You initiated to UDF to have colour, so you need to tell it what colours to use (all default in this case) Global $aLVCol_1[90][40] _GUIListViewEx_LoadColour($iLVIndex_1, $aLVCol_1) ; REregister WM_NOTIFY ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _GUIListViewEx_MsgRegister() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd So thank you for finding this unexplored corner of the UDF - I shall now amend the Guide and develop a UDF function to UNregister the WM_NOTIFY message when needed. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Â
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