Thread: [Fxruby-users] Sorting an IconList
Status: Inactive
Brought to you by:
lyle
From: Jamey C. <jc...@tw...> - 2004-02-26 14:58:46
|
Sorry if this question has been answered. I googled but did not find anything... I'm trying to sort an IconList by the column that is clicked when the user clicks a column header. If I use the sortItems method, it just sorts by the first column. I tried using sort_by: @iconlist.sort_by {|item| item.getText.split("\t")[@clickedColumn]} But that didn't do anything. Is there a way to sort the IconList by anything other than the first column? Thanks. Jamey Cribbs Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments. |
From: Jamey C. <jc...@tw...> - 2004-03-02 01:21:44
|
I'm bumping this message in the hopes that someone who can shed some light on it maybe missed it the first time around. Thanks. Jamey Jamey Cribbs wrote: > Sorry if this question has been answered. I googled but did not find > anything... > > I'm trying to sort an IconList by the column that is clicked when the > user clicks a column header. > > If I use the sortItems method, it just sorts by the first column. > > I tried using sort_by: > > @iconlist.sort_by {|item| item.getText.split("\t")[@clickedColumn]} > > But that didn't do anything. > > Is there a way to sort the IconList by anything other than the first > column? > > Thanks. > > Jamey Cribbs > > > > Confidentiality Notice: This email message, including any attachments, > is for the sole use of the intended recipient(s) and may contain > confidential and/or privileged information. If you are not the > intended recipient(s), you are hereby notified that any dissemination, > unauthorized review, use, disclosure or distribution of this email and > any materials contained in any attachments is prohibited. If you > receive this message in error, or are not the intended recipient(s), > please immediately notify the sender by email and destroy all copies > of the original message, including attachments. > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users > |
From: Lyle J. <ly...@kn...> - 2004-03-06 02:38:20
|
On Feb 26, 2004, at 8:56 AM, Jamey Cribbs wrote: > Sorry if this question has been answered. I googled but did not find > anything... > > I'm trying to sort an IconList by the column that is clicked when the > user clicks a column header. OK. > If I use the sortItems method, it just sorts by the first column. Yes, this is indeed the default sorting method. To sort the items differently, you need to override the icon item's <=> method, as you would generally do for sortable Ruby objects. Of course, since this isn't documented, you would have a hard time knowing that ;) Please see the attached program for a contrived, but hopefully illustrative, example. ;) > I tried using sort_by: > > @iconlist.sort_by {|item| item.getText.split("\t")[@clickedColumn]} Remember that Enumerable#sort_by doesn't do an in-place sort, but rather returns a new array of the sorted items, e.g. # After this, anArray is still unsorted! sortedArray = anArray.sort_by { ... } > Is there a way to sort the IconList by anything other than the first > column? If you have additional questions after checking out the attached example, please let me know. And I'll try to add some docs for this the next time around ;) Hope this helps, Lyle |
From: Jamey C. <jc...@tw...> - 2004-03-06 15:25:02
|
Lyle Johnson wrote: > If you have additional questions after checking out the attached > example, please let me know. And I'll try to add some docs for this > the next time around ;) > > Hope this helps, Thank you, it helped very much! I very much appreciate the working example you attached. It made the whole thing very clear. Thanks again and good luck in you new job! Jamey Cribbs |
From: Lyle J. <ly...@kn...> - 2004-03-06 02:39:31
Attachments:
iconlist.rb
|
On Feb 26, 2004, at 8:56 AM, Jamey Cribbs wrote: > Is there a way to sort the IconList by anything other than the first > column? Why do I always click "Send" before attaching the attachments? Oh, well, here it is... |