Jump to content

Deleting a Listview item..


Recommended Posts

How do I delete a listview item right after I've found it with _GUICtrlListView_FindInText()?

Thanks.

from the help file

#include <GuiConstantsEx.au3>
#include <GuiListView.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

Example_External()

Func Example_External()
    Local $GUI, $aItems[10][3], $hListView
    
    $GUI = GUICreate("(External) ListView Delete Item", 400, 300)
    $hListView = _GUICtrlListView_Create ($GUI, "col1|col2|col3", 2, 2, 394, 268)
    GUISetState()
    
   ; 3 column load
    For $iI = 0 To UBound($aItems) - 1
        $aItems[$iI][0] = "Item " & $iI
        $aItems[$iI][1] = "Item " & $iI & "-1"
        $aItems[$iI][2] = "Item " & $iI & "-2"
    Next

    _GUICtrlListView_AddArray ($hListView, $aItems)
    
    MsgBox(4160, "Information", "Delete Item")
    _GUICtrlListView_DeleteItem($hListView, 1)
    
   ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc  ;==>Example_External

also you have search option here at the forum

Link to comment
Share on other sites

from the help file

#include <GuiConstantsEx.au3>
#include <GuiListView.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

Example_External()

Func Example_External()
    Local $GUI, $aItems[10][3], $hListView
    
    $GUI = GUICreate("(External) ListView Delete Item", 400, 300)
    $hListView = _GUICtrlListView_Create ($GUI, "col1|col2|col3", 2, 2, 394, 268)
    GUISetState()
    
  ; 3 column load
    For $iI = 0 To UBound($aItems) - 1
        $aItems[$iI][0] = "Item " & $iI
        $aItems[$iI][1] = "Item " & $iI & "-1"
        $aItems[$iI][2] = "Item " & $iI & "-2"
    Next

    _GUICtrlListView_AddArray ($hListView, $aItems)
    
    MsgBox(4160, "Information", "Delete Item")
    _GUICtrlListView_DeleteItem($hListView, 1)
    
  ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc ;==>Example_External

also you have search option here at the forum

thanks smarty but everytime I have done that it gives me an error.
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...