Opened 15 years ago
Closed 13 years ago
#1954 closed Bug (Fixed)
ListViewItem returns 0 (failure) even though it populates the ListView
| Reported by: | anonymous | Owned by: | Jon |
|---|---|---|---|
| Milestone: | 3.3.9.21 | Component: | AutoIt |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | Cc: |
Description
When more sub-items are specified in the “text” parameter of function GUICtrlCreateListViewItem, the list view is populated with the sub-items that fit the ListView, but the control ID returned is 0.
The following script demonstrates this anomaly. In particular, $item2 is assigned 0 because it has one too many sub-items. The ID’s of each ListViewItem are shown in the input box.
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $listview, $item1, $item2, $item3, $input1, $msg
GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
$listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
$item1 = GUICtrlCreateListViewItem("1a|1b|1c", $listview)
$item2 = GUICtrlCreateListViewItem("2a|2b|2c|2d", $listview)
$item3 = GUICtrlCreateListViewItem("3a|3b|3c", $listview)
$input1 = GUICtrlCreateInput("$item1 = " & $item1 & ", $item2 = " & $item2 & ", $item3 = " & $item3, 10, 200, 200, 15)
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Attachments (0)
Change History (5)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Here is another modification
;~ $item2 = GUICtrlCreateListViewItem("2a|2b|2c|2d", $listview)
$item2 = GUICtrlCreateListViewItem("2a|2b", $listview)
In this case: less (only two) columns given it sucessfully create listview item and also corect nonzero control ID is returned.
So there is question if in case of more columns given shouldn't be returned correct nonzero control ID if Autoit can display it correctly (cut thrid unnecessary column internally)?
comment:3 by , 13 years ago
| Resolution: | → Rejected |
|---|---|
| Status: | new → closed |
comment:4 by , 13 years ago
| Resolution: | Rejected |
|---|---|
| Status: | closed → reopened |
comment:5 by , 13 years ago
| Milestone: | → 3.3.9.21 |
|---|---|
| Owner: | set to |
| Resolution: | → Fixed |
| Status: | reopened → closed |
Fixed by revision [8992] in version: 3.3.9.21

The $item2 is really invalid as it try to defined more field than the list number of columns can have.
The bug is it should not be displayed. Bad internal error handling.