Modify ↓
Opened 16 years ago
Closed 16 years ago
#1326 closed Bug (No Bug)
_GuiCtrlListView_DeleteItem does not handle control ID correctly
| Reported by: | martin | Owned by: | Gary |
|---|---|---|---|
| Milestone: | Component: | Standard UDFs | |
| Version: | 3.3.0.0 | Severity: | None |
| Keywords: | _GUICtrlListView_DeleteItem | Cc: |
Description
_GuiCtrlListView_DeleteItem works if the listview handle is passed but not if the control ID is passed.
The existing function is
; #FUNCTION# ==================================================================================================================== ; Name...........: _GUICtrlListView_DeleteItem ; Description ...: Removes an item from a list-view control ; Syntax.........: _GUICtrlListView_DeleteItem($hWnd, $iIndex) ; Parameters ....: $hWnd - Control ID/Handle to the control ; $iIndex - Zero based index of the list-view item to delete ; Return values .: Success - True ; Failure - False ; Author ........: Gary Frost (gafrost) ; Modified.......: ; Remarks .......: ; Related .......: _GUICtrlListView_DeleteAllItems, _GUICtrlListView_DeleteItemsSelected ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _GUICtrlListView_DeleteItem($hWnd, $iIndex) If $Debug_LV Then __UDF_ValidateClassName($hWnd, $__LISTVIEWCONSTANT_ClassName) If IsHWnd($hWnd) Then Return _SendMessage($hWnd, $LVM_DELETEITEM, $iIndex) <> 0 Else Local $ctrlID = _GUICtrlListView_GetItemParam($hWnd, $iIndex) If $ctrlID Then Return GUICtrlDelete($ctrlID) <> 0 EndIf Return False EndFunc ;==>_GUICtrlListView_DeleteItem
This could be
Func _GUICtrlListView_DeleteItem($hWnd, $iIndex) If $Debug_LV Then __UDF_ValidateClassName($hWnd, $__LISTVIEWCONSTANT_ClassName) If IsHWnd($hWnd) Then Return _SendMessage($hWnd, $LVM_DELETEITEM, $iIndex) <> 0 Else Return GuiCtrlSendMsg($hWnd, $LVM_DELETEITEM, $iIndex,0) <> 0 EndIf EndFunc ;==>_GUICtrlListView_DeleteItem
Attachments (0)
Note:
See TracTickets
for help on using tickets.

You should never destroy something AutoIt created with anything other than the specified function for destruction. To that end the Example2() in the documentation is actually doing something bad. Likewise, your suggestion is doing something bad. AutoIt will never free the internal resources for any items destroyed that way.