Champak Posted March 28, 2022 Posted March 28, 2022 Is it possible to hide, collapse, or set the height of rows? I want to be able to hide certain rows when needed.
Nine Posted March 28, 2022 Posted March 28, 2022 (edited) As explained in this thread, it is not easily possible to set row height individually in ListView, but you can on ListBox. You can GUICtrlDelete single/multiple rows, and recreate it at will...Hide will not work on ListView Edited March 28, 2022 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Champak Posted March 28, 2022 Author Posted March 28, 2022 That option doesn't suit my needs, so I'm going a different route. Thanks for the info.
Gianni Posted March 28, 2022 Posted March 28, 2022 (edited) if it suits you to hide/show groups of rows, and single rows as well, by using an expand/collapse way, you can have a look here then https://www.autoitscript.com/forum/topic/181835-listview-control-is-it-possible-the-collapseexpand-of-groups/ Edited March 28, 2022 by Gianni Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Champak Posted March 29, 2022 Author Posted March 29, 2022 Thanks, I think that might just work. Just have to see how it plays with everything else, but it looks good.
Moderators Melba23 Posted March 29, 2022 Moderators Posted March 29, 2022 Champak, Following on from your query in my GUIListViewEx thread I came to take a look here. To hide specific rows, why not get a copy of the ListView content into an array, remove the rows you do not wish to see and then reload the amended data into the ListView? 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
ad777 Posted March 29, 2022 Posted March 29, 2022 @Champak maybe this will help ya. expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> Example() Func Example() ; Create GUI GUICreate("ListView Add SubItem (v" & @AutoItVersion & ")", 400, 300) Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) GUISetState(@SW_SHOW) ; Set ANSI format ;~ _GUICtrlListView_SetUnicodeFormat($idListview, False) ; Load images Local $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($idListview), 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($idListview), 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($idListview), 0x0000FF, 16, 16)) _GUICtrlListView_SetImageList($idListview, $hImage, 1) ; Add columns _GUICtrlListView_InsertColumn($idListview, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($idListview, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($idListview, 2, "Column 3", 100) ; Add items _GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1, 1) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2, 2) _GUICtrlListView_AddItem($idListview, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1, 2) _GUICtrlListView_AddItem($idListview, "Row 3: Col 1", 2) Global $ItemBaseTxt, $baseIndx, $RetItemTxt ; Loop until the user exits. MsgBox(64, 'Row 1', 'Hidden') $RetItemTxt = _GUICtrlListView_HideRow($idListview, 'Row 1: Col 1', $ItemBaseTxt, $baseIndx);hide Row MsgBox(64, 'Row 1', 'Shown') _GUICtrlListView_ShowRowM($idListview, $ItemBaseTxt, $baseIndx, $RetItemTxt);Show Row Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func _GUICtrlListView_HideRow($hWnd, $Item, ByRef $base, ByRef $baseIndex) $ItemBase = _GUICtrlListView_FindInText($hWnd, $Item) $base = $Item $baseIndex = $ItemBase Local $add ;,$inc = 0 For $i = 1 To 255 $itemTxt = _GUICtrlListView_GetItem($hWnd, _GUICtrlListView_FindInText($hWnd, $Item), $i)[3] if $itemTxt <> '' Then ;$inc = $inc + 1 $add &= _GUICtrlListView_GetItem($hWnd, _GUICtrlListView_FindInText($hWnd, $Item), $i)[3] & "-" EndIf Next _GUICtrlListView_DeleteItem($hWnd, $ItemBase) Return $add EndFunc ;==>_GUICtrlListView_HideRow Func _GUICtrlListView_ShowRow($hWnd, $Item, $Index) Return _GUICtrlListView_InsertItem($hWnd, $Item, $Index) EndFunc ;==>_GUICtrlListView_ShowRow Func _GUICtrlListView_ShowRowM($hWnd, $ItemBaseTxt, $IndexBase, $PSubItem) Global $test, $inc = 0 _GUICtrlListView_InsertItem($hWnd, $ItemBaseTxt, $IndexBase) For $i = 0 To StringLen($PSubItem) if StringMid($PSubItem, $i, 1) = '-' Then $inc = $inc + 1 _GUICtrlListView_AddSubItem($hWnd, $IndexBase, $test, $inc, $inc) $test = '' Else $test &= StringMid($PSubItem, $i, 1) EndIf Next EndFunc ;==>_GUICtrlListView_ShowRowM none
Champak Posted March 30, 2022 Author Posted March 30, 2022 @Melba Thanks. The array and listview playing together is painfully slow. My array is 40 col and anywhere from 1500 to 2000 rows, and may get bigger depending on how I choose to manage it. So the speed is going to be an annoying sticking point with the array and listview. @ad777 that looks very cool. I don't fully understand it at a glance so I'm going to have to play with it and understand it. As long as it works with Melba's combobox listview I'll see how everything else pans out, thanks.
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