cheese Posted November 6, 2009 Share Posted November 6, 2009 (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 November 6, 2009 by cheese Link to comment Share on other sites More sharing options...
Achilles Posted November 6, 2009 Share Posted November 6, 2009 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] Link to comment Share on other sites More sharing options...
cheese Posted November 6, 2009 Author Share Posted November 6, 2009 Achilles, thank you. Now it work! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now