Jump to content

[Solved in v.3.2.13.8] The function _guictrllistview_setgroupinfo don't work twice


TalivanIBM
 Share

Recommended Posts

I need help!!!!!!!!!!!!!!! _GuiCtrlListView_SetGroupInfo DON'T WORK TWICE!!!!!!!!!!!!!!!!!!!

i have create a gui with a listview, and then i use user defined function to create groups and insert the items to the groups, but i would to set all the groups collapsible but don't work, only one of the groups is with the state collapsible, the other groups stay normal, i work with Vista, and the second time i use the setgroupinfo do nothing, don't change anything.

this code have been modified from the original AutoIt Help _GuiCtrlListView_SetGroupInfo

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
  #include <GuiConstantsEx.au3>
  #include <GuiListView.au3>
  #include <GuiImageList.au3>
  
  Opt('MustDeclareVars', 1)
  
  $Debug_LV = False; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work
  
  _Main()
  
  Func _Main()
      Local $aInfo, $hImage, $hListView, $gui, $id
      
      $gui = GUICreate("ListView Set Group Info", 400, 300)
  
;~   $hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
      $hListView = _GUICtrlListView_Create($gui, "", 2, 2, 394, 268)     ; ------ Modified
      GUISetState()
  
   ; Load images
      $hImage = _GUIImageList_Create()
      _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
      _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
      _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
      _GUICtrlListView_SetImageList($hListView, $hImage, 1)
  
   ; Add columns
      _GUICtrlListView_AddColumn($hListView, "Column 1", 100)
      _GUICtrlListView_AddColumn($hListView, "Column 2", 100)
      _GUICtrlListView_AddColumn($hListView, "Column 3", 100)
  
   ; Add items
      _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
      _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
      _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
      _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
      _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
      _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
  
   ; Build groups
      _GUICtrlListView_EnableGroupView($hListView)
      _GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1", 1)
      _GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
      _GUICtrlListView_SetItemGroupID($hListView, 0, 1)
      _GUICtrlListView_SetItemGroupID($hListView, 1, 2)
      _GUICtrlListView_SetItemGroupID($hListView, 2, 2)
  
   ; Change group information
      $aInfo = _GUICtrlListView_GetGroupInfo($hListView, 1)
      MsgBox(4160, "Information", "Group 1 Text: " & $aInfo[0])
;~  _GUICtrlListView_SetGroupInfo($hListView, 1, "New Group 1")
      _GUICtrlListView_SetGroupInfo($hListView, 1, "New Group 1", 0, $LVGS_COLLAPSIBLE)  ;----Start------Modified
      $id = _GUICtrlListView_GetItemGroupID($hListView, 2)                    ; the result will be 2, then $id = 2                        
      MsgBox(0, $id, "") 
      _GUICtrlListView_SetGroupInfo($hListView, $id, "Group 3", 0, $LVGS_COLLAPSIBLE)         ;----End-------Modified and don't work the second time, no change in the second group
  
   ; Loop until user exits
      Do
      Until GUIGetMsg() = $GUI_EVENT_CLOSE
  
      GUIDelete()
  EndFunc;==>_Main

please we have to solve this problem.

I have another post for this problem but here i put a code to prove the problem

Edited by TalivanIBM
Link to comment
Share on other sites

Caps must be important...

Yea seems it doesn't want to do it twice...you can do either one, but not both... Minimal script for reproduction:

#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

You could try reporting it for a bug fix... Although since I don't work with these much I don't know if this is intended or not.

Link to comment
Share on other sites

  • 2 weeks later...

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

  • Recently Browsing   0 members

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