Jump to content

Delete all items in CreateListView


Recommended Posts

In the help file

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF); will change background color

$listview = GuiCtrlCreateListView ("col1  |col2|col3  ",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GuiCtrlCreateButton ("Value?",75,170,70,20)
$item1=GuiCtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item3=GuiCtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GuiCtrlCreateInput("",20,200, 150)
GuiCtrlSetState(-1,$GUI_ACCEPTFILES) ; to allow drag and dropping
GuiSetState()
GUICtrlSetData($item2,"|ITEM1",)
GUICtrlSetData($item3,"||COL33",)
GUICtrlDelete($item1)

Do
  $msg = GuiGetMsg ()
     
   Select
      Case $msg = $button
         MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
      Case $msg = $listview
         MsgBox(0,"listview", "clicked="& GuiCtrlGetState($listview),2)
   EndSelect
Until $msg = $GUI_EVENT_CLOSE

$item1,2 and 3 are the listview items.

Im looking to delete all of them without going something like GUICtrlDelete($item2) etc.

Is there away I can delete every single item without assigning it when I create it like

$test = GuiCtrlCreateListViewItem("test",$listview)

I could just delete the whole ListView then make a new one, then it would me empty, but that seems 'wrong'

Any idea's?

Edited by Burrup

qq

Link to comment
Share on other sites

;===============================================================================
; Function:   _GUICtrlLVClear
; Author:       Gary Frost
;
; Description:   Clear all items in a listview
; Parameters:   $listview - The listview control to clear
; Requirements:  None
; Return Values: None
;
; Note:       None
;===============================================================================
Func _GUICtrlLVClear($listview)
    Local $LVM_DELETEALLITEMS = 0x1009
    GuiCtrlSendMsg($listview, $LVM_DELETEALLITEMS,0,0)
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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

  • Recently Browsing   0 members

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