Solved

Writing method response to onclick

Posted on 1999-01-12
5
163 Views
Last Modified: 2010-04-06
I have an application that creating some descendents of TShape during run time. I want to these objects that are created during run time to response to onclick method, how do i do that ? pls answer.
0
Comment
Question by:sellandbuy
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356121
You can use the OnMouseDown or OnMouseUp events. Just assign an event handler to the one you want when you create the TShape descendent.

Cheers,

Raymond.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1356122
Here is what you do...

form1 = class(TForm1)
...
private
  procedure MyHandler(Sender : TObject);
.......

var
  sh : TShape;
begin
  sh := TShape.Create;
  //Set Properties....
  sh.OnMouseUp := MyHandler;
end;

//Don't forget to free the object  when you are done with it...

procedure TFoirm1.MyHandler(Sender : TObject);
begin
  ShowMessage('You just clicked on the shape');
end;
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1356123
well, why did you reject rwilson's answer? Any comments what more you ned or something?

Thank you!

-Viktor
--Ivanov
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 100 total points
ID: 1356124
Sellandbuy:

I am re-answering this in the hope you will give us some indication of why you rejected my answer...

You can use the OnMouseDown or OnMouseUp events. Just assign an event handler to the one you want when you create the TShape
       descendent.

       Cheers,

       Raymond.
0
 

Author Comment

by:sellandbuy
ID: 1356125
I thought viktornet gave me a better answer so....
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now