gironella
20-12-2007, 10:36:35
Hola,
estoy intentando poner un checkbox en una celda de un TStringGrid en C++ Builder i tengo un problema:
No me deja clicarlo, i.e, cuando apreto encima suyo no se pone en ok.
TCheckBox *check4= new TCheckBox(this);
check4->Parent= grid;
check4->Visible= true;
check4->OnClick = test;
check4->Height = 14;
void __fastcall TfrmplgSimulation::test(TObject *Sender)
{
ShowMessage("ok");
}
void __fastcall TfrmplgSimulation::gridDrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State)
{
if (ACol==2 && ARow==3)
{
grid->Canvas->Brush->Color= grid->Color;
grid->Canvas->FillRect(Rect);
dynamic_cast<TCheckBox*>(grid->Objects[ACol][ARow])->Top=Rect.Top+4;
dynamic_cast<TCheckBox*>(grid->Objects[ACol][ARow])->Left = Rect.Left +12.5;
}
}
Esto es lo que tengo escrito. Si alguien me pudiera ayudar le estaria muy agradecido, porque me estoy volviendo locoooo.
Muchas gracias
estoy intentando poner un checkbox en una celda de un TStringGrid en C++ Builder i tengo un problema:
No me deja clicarlo, i.e, cuando apreto encima suyo no se pone en ok.
TCheckBox *check4= new TCheckBox(this);
check4->Parent= grid;
check4->Visible= true;
check4->OnClick = test;
check4->Height = 14;
void __fastcall TfrmplgSimulation::test(TObject *Sender)
{
ShowMessage("ok");
}
void __fastcall TfrmplgSimulation::gridDrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State)
{
if (ACol==2 && ARow==3)
{
grid->Canvas->Brush->Color= grid->Color;
grid->Canvas->FillRect(Rect);
dynamic_cast<TCheckBox*>(grid->Objects[ACol][ARow])->Top=Rect.Top+4;
dynamic_cast<TCheckBox*>(grid->Objects[ACol][ARow])->Left = Rect.Left +12.5;
}
}
Esto es lo que tengo escrito. Si alguien me pudiera ayudar le estaria muy agradecido, porque me estoy volviendo locoooo.
Muchas gracias