forlano Messages: 1207 Registered: March 2006 Location: Italy
Senior Contributor
fudadmin wrote on Wed, 05 April 2006 03:08
You are not lazy enough once again! 4 Operations!!! and so difficult?! You must avoid such thinking with Ultimate++...
Why not to start with easy things:
arr.Sort(int_col);
P.S. Sorry for the delay - I didn't want you to die so soon..
Only now I have had the chance to try it. I couldn't believe that this line was the solution. I've attached the following method
void Tab1::SortRecord() // body of the callback
{ arr.Sort(0);
}
to a button and it worked! .
If I put your line inside the AddPlayer method the array is always sorted. I prefer to see the added recod at the end and then sort when I need. So the decision of a new method... and new button...
This is really the perfect tool for lazy people. I can become mad if I remind the time lost to reinvent the wheel with other tool. I suspect my application ported to U++ will be long maybe 1/5 of the previous one.
But this is not what I wanted! In fact I wanted to click on the 'header' to get an array sorted. So I started to think in a lazy way... to prevent future complain . After some investigation I got the answer:
void Tab1::SortRecord()
{ int i;
i = arr.GetClickColumn();
arr.Sort( i );
}
associated to doubleclick event in the constructor
arr.WhenLeftDouble = THISBACK(SortRecord);
This is even better from point of view of lazyness because I do not need to move the mouse up to the header of the array when I am at its bottom (notoriously a very time and energy comsuming task). I hope you agree