Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,543 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,546 people online right now. Registration is fast and FREE... Join Now!




Borland6 C++ EventHandlers

 
Reply to this topicStart new topic

Borland6 C++ EventHandlers

tokajac
23 Nov, 2007 - 10:59 AM
Post #1

New D.I.C Head
*

Joined: 30 Apr, 2007
Posts: 5


My Contributions
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!




User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/7/09 09:26PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month