> boo...@at... wrote:
>
> > while I'm being dense, If I read the documentation for
> > wxListCtrl::SortItems correctly, I can only sort on the data for the
> > list items? So how would I make a listview that's sorted on the 3rd
> > column's data, besides using SetItemData to make sure the data's equal
> > to the 3rd column?
>
>
> Boo Radley, I think you are correct: you can only sort on an item's
> data. I think the only way of sorting is as you describe.
>
> <rant>
> Overall, Wx::ListCtrl is a very unpleasant and difficult to use control.
> For instance:
FWIW, I agree, and a lot of people agree. OTOH I think there are enough
methods in wxListCtrl so that a, say, Wx::EasyListCtrl can be implemented
and released to CPAN. It is a simple matter of programming.
> - Completely bizarre handling of selections. I would think it would make
> sense to have a method called GetSelection() or GetSelections() that
You can use GetNextItem to implement GetSelection[s]
> returns the index of a selected element. Apparently not. You need to set
> up an event and store the index of the selected item in a global
> variable. Lovely (!). Even more bizarre is handling of *multiple*
> selections. If a user selects N items, the event handler for selection
> is called N items. So you need to store the indices of selected items as
> keys in hash. Then you need to set up a event handler for items be
> unselected and delete the index out of the hash.
...no need to do this. There is a post somewhere in the archives
about how to use GetNextItem.
> - No documentation for Perl implementation of wxListItem, so I don't
> know how to iterate over the list control and use wxListItems to find
> out if any item is selected.
You could always ask ;-) Anyway it is documented in 2.3 docs:
go to wxPerl site -> wxWindows docs -> alphaetical class reference -> wxListItem
> - When items are inserted into the list, the item inserted first appears
> at the bottom of the list. This seems to contradict logic IMHO.
Mmh, if you think this is a bug, and you provide wxPerl/wxWindows version,
OS, a small snippet of code demonstrating the behaviour, we can decide
it it is a bug or not.
> - There is no SetPlData() function (as there is for the tree control),
> the only data that can be associated with an item is a long int. That
> means if you want to associate any Perl data you need to set up an array
> and store the index as an item's data.
>
> What makes this even more bizarre is that Wx::ListBox does actually
> provide a GetSelections() method and in general seems more sane. But it
> doesn't have a report view (which you wouldn't expect from a list *box*,
> so that's OK).....
The trouble is that the ListCtrl interface closely mimicks the Win32
control interface.
> Overall I like wxPerl and I recognise that most of the problems are
> caused by wxWindows, not the Perl interface... but I do not understand
> why Wx::ListCtrl is so awkward to use, and why it does not have a
> SetPlData() method.
Because wxWindows provides no means to implement it (apart from
using an array internally).
Regards
Mattia
|