Jump to content

Recommended Posts

Posted

Hi everybody :)
If we look at the help file example, topic _GUICtrlListView_SetGroupInfo , its 4th parameter is described like this :

$iAlign [optional] Alignment of the header text for the group:
0 - Left
1 - Center
2 - Right

This should be the correct display :

LVgroupalign.png.b2ca2006d6e9659ac4d62091879dd9bb.png

Here is the line in the script :

_GUICtrlListView_SetGroupInfo($idListview, 1, "New Group 1")
or
_GUICtrlListView_SetGroupInfo($idListview, 1, "New Group 1", 0) ; same (0 = left)

Now if you change this line to :

_GUICtrlListView_SetGroupInfo($idListview, 1, "New Group 1", 1) ; (1 = center)

Then to :

_GUICtrlListView_SetGroupInfo($idListview, 1, "New Group 1", 2) ; (2 = right)

Do you have the correct alignment in the 3 cases, as in the pic above ?
Or do the 3 displays are all on the left side ?

Thanks for testing

"I think you are searching a bug where there is no bug..."

Posted (edited)
15 hours ago, pixelsearch said:

Do you have the correct alignment in the 3 cases, as in the pic above ?

Yes. Win11.

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $hGui = GUICreate("ListView Get/Set Group Info (v" & @AutoItVersion & ")", 400, 300)
    WinSetOnTop($hGui, "", 1)

    Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Set ANSI format
;~     _GUICtrlListView_SetUnicodeFormat($idListview, False)

    ; Load images
    Local $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0x0000FF, 16, 16))
    _GUICtrlListView_SetImageList($idListview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Column 0", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 1", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 2", 100)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Row 0: Col 0", 0)
    _GUICtrlListView_AddSubItem($idListview, 0, "Row 0: Col 1", 1)
    _GUICtrlListView_AddSubItem($idListview, 0, "Row 0: Col 2", 2)
    _GUICtrlListView_AddItem($idListview, "Row 1: Col 0", 1)
    _GUICtrlListView_AddSubItem($idListview, 1, "Row 1: Col 1", 1)
    _GUICtrlListView_AddItem($idListview, "Row 2: Col 0", 2)

    ; Build groups
    _GUICtrlListView_EnableGroupView($idListview)
    _GUICtrlListView_InsertGroup($idListview, -1, 1, "Group 1", 1)
    _GUICtrlListView_InsertGroup($idListview, -1, 2, "Group 2")
    _GUICtrlListView_SetItemGroupID($idListview, 0, 1)
    _GUICtrlListView_SetItemGroupID($idListview, 1, 2)
    _GUICtrlListView_SetItemGroupID($idListview, 2, 2)

    ; Change group information
    Local $aInfo = _GUICtrlListView_GetGroupInfo($idListview, 1)
;~  MsgBox($MB_SYSTEMMODAL, "Information", "Group 1 Text: " & $aInfo[0])
;~  _GUICtrlListView_SetGroupInfo($idListview, 1, "New Group 1")
;~  _GUICtrlListView_SetGroupInfo($idListview, 1, "New Group 1", 0) ; left
;~  _GUICtrlListView_SetGroupInfo($idListview, 1, "New Group 1", 1) ; center
    _GUICtrlListView_SetGroupInfo($idListview, 1, "New Group 1", 2) ; right

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()
EndFunc   ;==>Example

image.png.33b775c5711cda5eb317d483c8731f62.png   image.png.95a2933255ca120106fa16b6970f369f.png

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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