Jump to content

Recommended Posts

Posted (edited)

Hi!

Why it don't works?

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
$Gui = GUICreate("_GUICtrlListView_DeleteAllItems",300,200)
$btnAdd = GUICtrlCreateButton("Add",2,2,120,23)
$btnDel = GUICtrlCreateButton("Delete",134,2,120,23)
$hListView = GUICtrlCreateListView("Items",2,27,296,171)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $btnAdd
            For $i = 1 To 5
            _GUICtrlListView_AddItem($hListView,$i)
            GUICtrlSetData($btnDel,"Delete")
            Next
        Case $btnDel
            _GUICtrlListView_DeleteAllItems($hListView)
            GUICtrlSetData($btnDel,"Why It Not Work?")
    EndSwitch
WEnd
GUIDelete()
Edited by cheese
Posted

I'm not sure why it doesn't work. This does: (just added a GUICtrlGetHandle around the $hListview)

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
$Gui = GUICreate("_GUICtrlListView_DeleteAllItems",300,200)
$btnAdd = GUICtrlCreateButton("Add",2,2,120,23)
$btnDel = GUICtrlCreateButton("Delete",134,2,120,23)
$hListView = GUICtrlCreateListView("Items",2,27,296,171)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $btnAdd
            For $i = 1 To 5
            _GUICtrlListView_AddItem($hListView,$i)
            GUICtrlSetData($btnDel,"Delete")
            Next
        Case $btnDel
            _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))
            GUICtrlSetData($btnDel,"Why It Not Work?")
    EndSwitch
WEnd
GUIDelete()
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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