BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TCustomGrid and DrawCell

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Edo
Guest





PostPosted: Sat Jan 29, 2005 11:03 am    Post subject: TCustomGrid and DrawCell Reply with quote



Hi, I'm writing a component derived from TCostamGrid with goEditing Option

I've a problem in my DrawCell event, I'm not able to read the cells value,
With stinggrid I use

Canvas->TextRect(ARect, ARect.Left+1, ARect.Top+5, Cells[Acol][ARow]);

but Cells property does not exist in TCustomgrid

so, ho can I read cells value?

this is my dDrawCell evnt, thank a lot
bye, edo

void __fastcall TMyGrid::DrawCell(int ACol, int ARow, const TRect
&ARect, TGridDrawState AState)
{
if (AState.Contains(gdSelected))
{
Canvas->Brush->Color = TColor(0x00737373);
Canvas->Font->Color = clWhite;
Canvas->FillRect(ARect);
}
else
{
Canvas->Brush->Color = clWindow;
Canvas->Font->Color = clWindowText;
Canvas->FillRect(ARect);
}

Canvas->Brush->Style = bsClear;
Canvas->TextRect(ARect, ARect.Left+1, ARect.Top+5, ????);
}


Back to top
Rafal Z
Guest





PostPosted: Sat Jan 29, 2005 7:49 pm    Post subject: Re: TCustomGrid and DrawCell Reply with quote



Edo wrote:
Quote:
Hi, I'm writing a component derived from TCostamGrid with goEditing Option

I've a problem in my DrawCell event, I'm not able to read the cells value,
With stinggrid I use

Canvas->TextRect(ARect, ARect.Left+1, ARect.Top+5, Cells[Acol][ARow]);

but Cells property does not exist in TCustomgrid

so, ho can I read cells value?

this is my dDrawCell evnt, thank a lot
bye, edo

void __fastcall TMyGrid::DrawCell(int ACol, int ARow, const TRect
&ARect, TGridDrawState AState)
{
if (AState.Contains(gdSelected))
{
Canvas->Brush->Color = TColor(0x00737373);
Canvas->Font->Color = clWhite;
Canvas->FillRect(ARect);
}
else
{
Canvas->Brush->Color = clWindow;
Canvas->Font->Color = clWindowText;
Canvas->FillRect(ARect);
}

Canvas->Brush->Style = bsClear;
Canvas->TextRect(ARect, ARect.Left+1, ARect.Top+5, ????);
}


Cells property exists only in TStringGrid, if you need to store data for

each cell then you have to implement a datastructure for this by
yourself. If you did it then you can declare a Cell proprty with getter
and setter. For example for strings you could use TStringlist for each
column if you want strings to store in cells.

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sat Jan 29, 2005 11:05 pm    Post subject: Re: TCustomGrid and DrawCell Reply with quote




"Edo" <buildweb (AT) infinito (DOT) it> wrote


Quote:
I've a problem in my DrawCell event, I'm not able to read the cells value

TCustomGrid has no Cells to begin with. TCustomGrid has no concept of data
at all. It is just a basic generic grid display. It is your own
responsibility to provide your own data storage. Otherwise, derive from
TStringGrid instead of TCustomGrid.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.