Hi all,
I'm programming a component that is a derivate from TStringGrid. I want to put inside a TListBox component, so in each cell of the grid I'll be able to have multiple Items. (Well, in fact it isn't a TListBox rather than an own component derivated from it, but for the question, it should be enough with that infomration).
I Associated the TListBox to the TStringGrid with:
Code:
TStringList1->Objects[x][y]=objListBox;
I don't want to use scrolling inside each cell (it appears awfull), so when I add an Item in a TListBox inside a Cell, I grow up the Height of the TListBox, and the RowHeights[ARow].
Well, I have override the DrawCell method of the TStringGrid, so I can draw the TListBox.
Code:
void __fastcall TBitmapStringGrid::DrawCell(int ACol, int ARow, const Types::TRect &ARect, TGridDrawState AState)
{
TListBox* objListBox = ( TListBox* )(Objects[ACol][ARow] );
if (objListBox != NULL) //only if there are data
{
objListBox->Top = ARect.Top;
objListBox->Left = ARect.Left;
objListBox->Height = ARect.Bottom - ARect.Top + 1;
objListBox->Width = ARect.Right - ARect.Left + 1;
objListBox->Visible = True;
}
Canvas->Brush->Color=clWhite;
Canvas->FillRect(ARect);
}
The problem is that when I scroll, it does extrange things. It overwrites the blank cells, and I'm unable to get that it scrolls correctly. The TlistBox component don't scroll when the TStrginGrid scroll.
I Read in http://www.bridgespublishing.com/art...ds__part_I.htm
that (obviously) it's a known issue of this, but I'm unable to find a solution.
Help please!
Regards,
Daniel