Ticket #10687 (closed defect: fixed)
Misterious "ListView_SetItem failed" now with assertion (msw)
| Reported by: | nitram.cero | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | wxMSW | Version: | 2.9-svn |
| Keywords: | Cc: | ||
| Blocked By: | Patch: | no | |
| Blocking: |
Description
Where do I begin?...
ClearAll() is confusing. I used it as if it were a "DeleteAllItems()".
Then when I wanted to SetItem() with a column > 0 on a new item, it failed (as ClearAll also counter-intuitively removes the columns).
Windows' GetLastError() returned nothing at all. It gave me a headache.
I think ClearAll() should be deprecated to give place to ClearItems()/ClearColumns().
Because "clear" in programming usually means a complete removal of data, not the structure that holds it.
It's similar to say that to "clear a grid control" would have to make the columns and rows equal to 1.
It's confusing.
On to the fix:
I added an assertion in wxMSW's "wxConvertToMSWListItem" to check if the info parameter column is in a valid range acording to ctrl parameter's column count.
I attached the patch (made from SVN 60049)
Also commented out a "item.cchTextMax = 0;" before the SetItem call that was absurd. If needed for any reason, it should be at wxConvertToMSWListItem() instead of being in SetItem function like a hack.
Regards
-Martín

