Solved

Writing method response to onclick

Posted on 1999-01-12
5
165 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

786 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