From: boo r. <boo...@at...> - 2002-10-13 19:55:53
|
Nick Johnston wrote: > 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: > - Completely bizarre handling of selections. I would think it would make > sense to have a method called GetSelection() or GetSelections() that > 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 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. > - When items are inserted into the list, the item inserted first appears > at the bottom of the list. This seems to contradict logic IMHO. > - 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)..... > </rant> > > 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. > > - Nick > > > > |