Jump to content

ListView with group enabled


Recommended Posts

Why ListView_EnableGroupView() modify the arrangement of items in my list view?

#include <GuiListView.au3>
#Include <WinAPI.au3>
#Include <WindowsConstants.au3>

$hMain = GUICreate('',305,140,Default,Default)
$hListView = _GUICtrlListView_Create($hMain,"",0,0,305,140,BitOR(0x0000,0x0004,0x4000))

;~  _GUICtrlListView_EnableGroupView($hListView)    ; uncomment this line and check again
    _GUICtrlListView_SetView($hListView,1)
    _GUICtrlListView_SetIconSpacing($hListView,95,70)

    ; Groups
    _GUICtrlListView_InsertGroup($hListView,0,1,"Asia")
    _GUICtrlListView_InsertGroup($hListView,1,2,"Europa")

    ; Add Items
    _GUICtrlListView_AddItem($hListView,"Turkmenistan")
    _GUICtrlListView_AddItem($hListView,"Israel")
    _GUICtrlListView_AddItem($hListView,"China")
    _GUICtrlListView_AddItem($hListView,"Vietnam")
    _GUICtrlListView_AddItem($hListView,"Japan")
    _GUICtrlListView_AddItem($hListView,"Romania")
    _GUICtrlListView_AddItem($hListView,"United Kigdom")

    ; Set Groups
    _GUICtrlListView_SetItemGroupID($hListView,0,1)
    _GUICtrlListView_SetItemGroupID($hListView,1,1)
    _GUICtrlListView_SetItemGroupID($hListView,2,1)
    _GUICtrlListView_SetItemGroupID($hListView,3,1)
    _GUICtrlListView_SetItemGroupID($hListView,4,1)
    _GUICtrlListView_SetItemGroupID($hListView,5,2)
    _GUICtrlListView_SetItemGroupID($hListView,6,2)

GUISetState(@SW_SHOW)

Do
    Sleep(10)
Until GUIGetMsg() = -3

When the words fail... music speaks.

Link to comment
Share on other sites

i had the same prob. you have to adjust the spacing. dunno why.

_GUICtrlListView_SetIconSpacing($hListView,85,70)

E.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...