 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Edo Guest
|
Posted: Sat Jan 29, 2005 11:03 am Post subject: TCustomGrid and DrawCell |
|
|
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
|
Posted: Sat Jan 29, 2005 7:49 pm Post subject: Re: TCustomGrid and DrawCell |
|
|
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
|
Posted: Sat Jan 29, 2005 11:05 pm Post subject: Re: TCustomGrid and DrawCell |
|
|
"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 |
|
 |
|
|
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
|
|