About Store Forum Documentation Contact



Post Reply 
ListColumn with custom Str data_to_text func
Author Message
Eric Offline
Member

Post: #1
ListColumn with custom Str data_to_text func
Hello,
lately I've tried to create a list column with my custom Str data_to_text function (it returns only date, without hours from DateTime). Here's the body:
Code:
Str DateFromDT(C DateTime &dt)
{
   return dt.asText(false).clip(10);
}
and here's the column constructor I use:
Code:
ListColumn date_list_column[]=
{
   ListColumn(DateFromDT(MEMBER(Player, date)), 0.50f, L"date"),
}
After starting the application I get this error pointed on my function:
Code:
Unhandled exception at 0x00(...).: Access violation reading location 0x00(...)
and I have no idea what's wrong with this function smile Maybe you have?

Regards,
Eric 'Eri' Przychocki
ourgames.eu
01-31-2014 04:00 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: ListColumn with custom Str data_to_text func
Hi,
You need to do:

Code:
Str DateFromDT(C DateTime &dt)
{
    return dt.asText(false).clip(10);
}
Str PlayerDate(C Player &plr) {return DateFromDT(plr.date);}
ListColumn(MemberDesc(MEMBER(Player, date)).setDataToTextFunc(PlayerDate), ..

You can check this tutorial for something similar:
"16 - Properties"
02-01-2014 10:28 PM
Find all posts by this user Quote this message in a reply
Eric Offline
Member

Post: #3
RE: ListColumn with custom Str data_to_text func
Of course you mean "setDataToTextFunc" wink
Thank you!

Regards,
Eric 'Eri' Przychocki
ourgames.eu
02-02-2014 11:19 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: ListColumn with custom Str data_to_text func
yes, sorry, I've updated my previous post
02-03-2014 08:51 PM
Find all posts by this user Quote this message in a reply
Post Reply