stalker87
25-06-2008 19:23:58
2 st4lk3r87 I just implemented
Code:
void Multilist::sortByColumn(size_t _column, bool _backward);
Now MultiList can be sorted not only by clicking on columns header, but also by calling this function.
P.S. Next time ask in our new forum.
Thanks but i've a little question...
With a list of number in my column the result will be:
900
9000
800
8000
Cause they're treated like string and not like numbers obviously... am i wrong ?
Altren
25-06-2008 19:35:27
Oh, you are right. At the moment we use Ogre::UTFString::operator< . I think I'll add possibility to use custom less than operator.
Altren
05-07-2008 01:23:08
It took a bit more time than I expected (made some fool mistakes). Update from svn. Here's example for your case.
void operatorLess(MyGUI::WidgetPtr _sender, size_t _column, const Ogre::UTFString & _firstItem, const Ogre::UTFString & _secondItem, bool & _less)
{
// sort second column by integer value and all other lexicographically
if ( _column == 1 )
{
_less = MyGUI::utility::parseInt(_firstItem) < MyGUI::utility::parseInt(_secondItem);
}
else
{
_less = _firstItem < _secondItem;
}
}
//...
multilist->operatorLess = MyGUI::newDelegate(/*this, CLASS::*/operatorLess);
stalker87
06-07-2008 21:40:33
Oh Great... i'll implement that immediately
stalker87
09-07-2008 00:43:11
I encounter a problem while i assign a delegate to operatorLess...
Here the exception image.
Altren
09-07-2008 01:51:39
Run in debug mode and show exception message (in release mode it can show error almost anywhere

, look you have
this at 0x00000014 and this value is wrong).
By the way, can you explain why you call
m_widgets = new MyGUI::VectorWidgetPtr(MyGUI::LayoutManager::getInstance.load(...));
instead
m_widgets = MyGUI::LayoutManager::getInstance.load(...);
?
stalker87
09-07-2008 22:21:15
Here the error in debug mode.
By the way, can you explain why you call
Code:
m_widgets = new MyGUI::VectorWidgetPtr(MyGUI::LayoutManager::getInstance.load(...));
instead
Code:
m_widgets = MyGUI::LayoutManager::getInstance.load(...);
?
m_widgets is a pointer to a MyGUI::VectorWidgetPtr so i need to create it dinamically with a copy constructor.
Altren
14-07-2008 23:14:11
Check your pointers. I think some of them are invalid.
stalker87
21-07-2008 15:02:19
Some of them?
Everything go fine if i comment this line
list->operatorLess = MyGUI::delegates::newDelegate( this, &PacHighScore::orderList );
ç___ç
Altren
22-07-2008 22:54:23
Show your PacHighScore::orderList function.
Just noticed that you use MyGUI::delegates::newDelegate() - you can use MyGUI::newDelegate() it's same function with shorter name.
stalker87
06-08-2008 13:42:31
ok here the code
void PacHighScore::orderList(MyGUI::WidgetPtr _sender, size_t _column, const Ogre::UTFString & _firstItem, const Ogre::UTFString & _secondItem, bool & _less)
{
// sort second column by integer value and all other lexicographically
if ( _column == 1 )
{
_less = MyGUI::utility::parseInt(_firstItem) < MyGUI::utility::parseInt(_secondItem);
}
else
{
_less = _firstItem < _secondItem;
}
}
stalker87
13-09-2008 13:07:22
Sorry for my spam but i need to resolve this problem :\