Gyzmok Posted July 14, 2008 Posted July 14, 2008 I have a problem with the _GUICtrlListView_DeleteItemsSelected() command.Depending on how the item was added to the list, it will be deleted or not ...If the item was added with the _GUICtrlListView_AddItem() command, the _GUICtrlListView_DeleteItemsSelected() does not seem to work.I am using autoit v3.2.12.0 , but can also reproduce in v3.2.13.3 (beta).I made a simple example script :expandcollapse popup#include <GuiConstantsEx.au3> #Include <GuiListView.au3> #include <WindowsConstants.au3> ; $myGUI = GuiCreate("_GUICtrlListView_DeleteItemsSelected problem ? ",500, 350,(@DesktopWidth-500)/2, (@DesktopHeight-350)/2 _ ,$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) ; $hListView = GUICtrlCreateListView("test", 23, 120, 425, 210, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT,$LVS_EX_CHECKBOXES)) _GUICtrlListView_SetColumnWidth($hListView,0,300) ; $Button_add1 = GuiCtrlCreateButton("Add to list - method 1",23,23,200,25) $Button_add2 = GuiCtrlCreateButton("Add to list - method 2",23,60,200,25) $Button_remove = GuiCtrlCreateButton("Delete seleted items from list",250,40,200,25) ; GUISetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button_add1 _add_item_method1() Case $msg = $Button_add2 _add_item_method2() Case $msg = $Button_remove _GUICtrlListView_DeleteItemsSelected($hListView) Case Else EndSelect WEnd ; func _add_item_method1() local $text = "add item method1" GUICtrlCreateListViewItem($text,$hListView) EndFunc ; func _add_item_method2() local $text = "add item method2" _GUICtrlListView_AddItem($hListView,$text) EndFuncAs you can see :Items added with method2 : _GUICtrlListView_AddItemwill not be deleted when selecting them and pushing "Delete seleted items from list"Is this normal/intended behaviour ?Greets,Guy D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper
GaryFrost Posted July 14, 2008 Posted July 14, 2008 I have a problem with the _GUICtrlListView_DeleteItemsSelected() command. Depending on how the item was added to the list, it will be deleted or not ... If the item was added with the _GUICtrlListView_AddItem() command, the _GUICtrlListView_DeleteItemsSelected() does not seem to work. I am using autoit v3.2.12.0 , but can also reproduce in v3.2.13.3 (beta). I made a simple example script : expandcollapse popup#include <GuiConstantsEx.au3> #Include <GuiListView.au3> #include <WindowsConstants.au3> ; $myGUI = GuiCreate("_GUICtrlListView_DeleteItemsSelected problem ? ",500, 350,(@DesktopWidth-500)/2, (@DesktopHeight-350)/2 _ ,$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) ; $hListView = GUICtrlCreateListView("test", 23, 120, 425, 210, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT,$LVS_EX_CHECKBOXES)) _GUICtrlListView_SetColumnWidth($hListView,0,300) ; $Button_add1 = GuiCtrlCreateButton("Add to list - method 1",23,23,200,25) $Button_add2 = GuiCtrlCreateButton("Add to list - method 2",23,60,200,25) $Button_remove = GuiCtrlCreateButton("Delete seleted items from list",250,40,200,25) ; GUISetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button_add1 _add_item_method1() Case $msg = $Button_add2 _add_item_method2() Case $msg = $Button_remove _GUICtrlListView_DeleteItemsSelected($hListView) Case Else EndSelect WEnd ; func _add_item_method1() local $text = "add item method1" GUICtrlCreateListViewItem($text,$hListView) EndFunc ; func _add_item_method2() local $text = "add item method2" _GUICtrlListView_AddItem($hListView,$text) EndFunc As you can see : Items added with method2 : _GUICtrlListView_AddItem will not be deleted when selecting them and pushing "Delete seleted items from list" Is this normal/intended behaviour ? Greets, Guy Use one or the other don't mix. If you use _GUICtrlListView_AddItem then pass the handle to the control to the _GUICtrlListView_DeleteItemsSelected function. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Gyzmok Posted July 14, 2008 Author Posted July 14, 2008 Ok, tnx Gary It was indeed a mixing problem in my script. I now use it like this : _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($hListView)) expandcollapse popup#include <GuiConstantsEx.au3> #Include <GuiListView.au3> #include <WindowsConstants.au3> ; $myGUI = GuiCreate("_GUICtrlListView_DeleteItemsSelected problem ? ",500, 350,(@DesktopWidth-500)/2, (@DesktopHeight-350)/2 _ ,$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) ; $hListView = GUICtrlCreateListView("test", 23, 120, 425, 210, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT,$LVS_EX_CHECKBOXES)) _GUICtrlListView_SetColumnWidth($hListView,0,300) ; ;$Button_add1 = GuiCtrlCreateButton("Add to list - method 1",23,23,200,25) $Button_add2 = GuiCtrlCreateButton("Add to list - method 2",23,60,200,25) $Button_remove = GuiCtrlCreateButton("Delete seleted items from list",250,40,200,25) ; GUISetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit ;Case $msg = $Button_add1 ; _add_item_method1() Case $msg = $Button_add2 _add_item_method2() Case $msg = $Button_remove _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($hListView)) Case Else EndSelect WEnd ; ;func _add_item_method1() ; local $text = "add item method1" ; GUICtrlCreateListViewItem($text,$hListView) ;EndFunc ; func _add_item_method2() local $text = "add item method2" _GUICtrlListView_AddItem($hListView,$text) EndFunc D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper
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