Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Writing method response to onclick

Posted on 1999-01-12
5
Medium Priority
?
171 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 200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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 video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Integration Management Part 2

916 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