Grid - Registered Users - Helpdesk
Setting font color in getdrawstate event
Thread Starter: Demeter László Started: 7/10/2007 5:16 PM UTC
Replies: 2
Setting font color in getdrawstate event
Hi Nicholas,

Can You please tell me how to avoid this error:

[BCC32 Error] Unit1.cpp(168): E2522 Non-const function _fastcall TFont::SetColor(const TColor) called for const object

The event is like:

void __fastcall TForm1::pgTestGetDrawState(TProfGrid *Sender, int ACol, int ARow, TGridDrawState &AState, TColor &AColor, const TFont *AFont)
{
if(exp1)
AFont->Color = COLOR_DEFINE;
}


Thank You
-Demeter
Re: Setting font color in getdrawstate event
Hi,

I have it.
The only thing is that you have to cast it to TFont*;

TFont* MyFont = (TFont*)AFont; //(TFont*) is important
MyFont->Color = .....

-Demeter
Re: Setting font color in getdrawstate event
Hi Demeter,

The issue will be addressed in the next release. Thanks for letting me know about the problem.


-Nicholas