Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Writing method response to onclick

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 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