Jump to content

Recommended Posts

Posted (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 by Nine
  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

@Champak

maybe this will help ya.;)

#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

Posted

@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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...