Modify

Opened 12 years ago

Closed 12 years ago

#586 closed Bug (Fixed)

Function _GuiCtrlListView_SetGroupInfo Don't Work Twice

Reported by: TalivanIBM Owned by: Valik
Milestone: 3.2.13.8 Component: AutoIt
Version: 3.2.12.1 Severity: None
Keywords: Cc:

Description

This function works only one time, after one application don't work.

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $hImage, $hListView,
   
    ;Create GUI
    $hListView = _GUICtrlListView_Create(GUICreate("ListView Set Group Info", 400, 300), "", 2, 2, 394, 268)
    GUISetState()

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

   ; Add columns
    _GUICtrlListView_AddColumn($hListView, "Column 1", 100)

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

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

   ; Change group information
    _GUICtrlListView_SetGroupInfo($hListView, 1, "New Group 1", 1, $LVGS_COLLAPSIBLE)
    _GUICtrlListView_SetGroupInfo($hListView, 2, "New Group 2", 1, $LVGS_COLLAPSIBLE); <--- Not applied

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

    GUIDelete()
EndFunc  ;==>_Main

Attachments (0)

Change History (3)

comment:1 Changed 12 years ago by Valik

Saying it "don't work" isn't very helpful. What doesn't work? How are you running it? I can run multiple or consecutive instances of the script and it works fine every time. You need to provide more details.

comment:2 Changed 12 years ago by TalivanIBM

Well don't do anything the second time you use the function in the same run, ex: i need to set collapsible 38 groups and only set the state to one of the groups, or simply change the name to the 2 groups like in the example in this bug.

See the new example with MsgBox.

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $hImage, $hListView
   
    ;Create GUI
    $hListView = _GUICtrlListView_Create(GUICreate("ListView Set Group Info", 400, 300), "", 2, 2, 394, 268)
    GUISetState()

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

   ; Add columns
    _GUICtrlListView_AddColumn($hListView, "Column 1", 100)

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

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

   ; Change group information
   MsgBox(0, "First Group", "Setting the name to 'New Group 1', and the state of 'COLLAPSIBLE'")
    _GUICtrlListView_SetGroupInfo($hListView, 1, "New Group 1", 1, $LVGS_COLLAPSIBLE)
	MsgBox(0, "Second Group", "Setting the name to 'New Group 2', and the state of 'COLLAPSIBLE'" & @LF & "This time the function will not work.")
    _GUICtrlListView_SetGroupInfo($hListView, 2, "New Group 2", 1, $LVGS_COLLAPSIBLE); <--- Not applied
	MsgBox(0, "Second Group", "See the second group; the changes are not applied. That is the error, DON'T WORK TWICE and ANYMORE IN THE SAME SCRIPT.")

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

    GUIDelete()
EndFunc  ;==>_Main

comment:3 Changed 12 years ago by Valik

  • Milestone set to 3.2.13.8
  • Owner set to Valik
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed in version: 3.2.13.8

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Valik.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.