I have a problem with event handling from code.
I want to fill a StringGrid row with color. I did that with implementing the OnDrawCell Event.
I still don't know how to use that event!
On regular events i write code like:
CODE
TMenuItem *itemPod = new TMenuItem(PopupMenu2);
itemPod->OnClick = ClickingTheButton;
CODE
void __fastcall TForm1::ClickingTheButton(TObject *Sender)
{
....
}
---------------------------------------------------------------------------------
But in this situation i don't know which arguments should i use?!
CODE
TMenuItem *itemPod = new TMenuItem(PopupMenu2);
itemPod->OnClick = ????????????????; <-----this is missing!
CODE
void __fastcall TUtakmica::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
StringGrid1->Canvas->Brush->Color = clBlue;
StringGrid1->Canvas->Font->Color = clRed;
StringGrid1->Canvas->FillRect(Rect);
StringGrid1->Canvas->TextRect(Rect, Rect.Left, Rect.Top, StringGrid1->Cells[ACol][ARow]);
}
I realized that this event is hapening on formCreate where StringGrid is.
I want to call this event only on button click and not on formCreate!
How can i do this!
Thx!