|
|
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » How to sort the ArrCtrl [SOLVED]
How to sort the ArrCtrl [SOLVED] [message #2228] |
Tue, 04 April 2006 18:50  |
 |
forlano
Messages: 1207 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
In the ArrCtrl documentation there are many Sort methods with obscure (for me) syntax.
I can avoid all of them with the following approach:
1) get the record from the array
2) sort them
3) clear the array
4) put the sorted record in the array.
But I am sure there is shortcut for it thought for lazy man. Just I would like to click on the header of the array and it show the new order. Is there somebody (I know who ) that can show one minimalist example?
Thank you,
Luigi
[Updated on: Mon, 01 May 2006 10:25] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: How to sort the ArrCtrl [message #2276 is a reply to message #2275] |
Wed, 05 April 2006 18:03   |
 |
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
luzr wrote on Wed, 05 April 2006 16:49 | Sorry, that is wrong. GetClickColumn returns the column, but only if you click at "cells".
What you need to use is WhenAction of HeaderCtrl::Column like this:
array.AddColumn("MyColumn").HeaderTab().WhenAction = THISBACK(SortByColumn);
BTW, quite handy here is using THISBACK1, because that way you can pass column index:
void MyApp::SortColumn(int column)
{
array.Sort(i);
}
.....
array.AddColumn("MyColumn1").HeaderTab().WhenAction = THISBACK1(SortByColumn, 0);
array.AddColumn("MyColumn2").HeaderTab().WhenAction = THISBACK1(SortByColumn, 1);
Mirek
|
Mirek,
You have been faster than me!
You have too much free time...
...
|
|
|
|
Re: How to sort the ArrCtrl [message #2279 is a reply to message #2277] |
Wed, 05 April 2006 18:43  |
 |
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
luzr wrote on Wed, 05 April 2006 17:12 |
Quote: | You have been faster than me!
You have too much free time...
...
|
Yes, when I am _supposed_ to do my "money" work, I have usually a plenty of time responding to forum Which will inevitably result to lagging my work progress, being awake for too long and sleeping for only 5 hours... again... 
Mirek
|
Mirek, you know that I'm really concerned about your wellbeing. That's why I'm trying to learn as much, and as quickly, as possible myself to help the Ultimate++ cause.
You don't have to respond in these "Forlano lessons" immediately. I'm trying to teach with some fun aspect and also let Luigi to discover some things himself while sometimes only providing just hints.
Anyway, thanks a lot once again and care yourself!
|
|
|
Goto Forum:
Current Time: Sun Apr 27 18:32:30 CEST 2025
Total time taken to generate the page: 0.00491 seconds
|
|
|