Adding OnClick Event to TGraphicControl descendent

Posted on 1998-07-15
Last Modified: 2013-11-23
I am using a colored bevel which is a descendent of TGraphicControl. How can I add a OnClick event to this component ?
Question by:moonrise
LVL 10

Expert Comment

ID: 1357953
When you create your graphic set it's OnClick event to some of you functions that you've created...

type TGraph = class
procedure YourCreatedProcedureForOnClick;
    yourtype.OnClick := YourCreatedProcedureForOnClick;
procedure YourCreatedProcedureForOnClick;
..your code goes here
Viktor Ivanov

Accepted Solution

nileq earned 50 total points
ID: 1357954
The most basic events are defined in the objekt type TControl. All Controls inherit these events. Among these basic events are OnClick. So your component allready has this event defined, it's just not visible.
The declarations of standardevents are PROTECTED, as are the methods that corresponds to them. To make a standardevet accessible you need to redeclare the event property as either PUBLIC or PUBLISHED.

To do this you simply add the following code:

TMyControl = Class(TGraphicControl)

  property OnClick; //Makes it visible in the objekt inspector

Let me know if it works.

Author Comment

ID: 1357955
Thank you, it works great.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

11 Experts available now in Live!

Get 1:1 Help Now