Solved

Adding OnClick Event to TGraphicControl descendent

Posted on 1998-07-15
3
868 Views
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 ?
0
Comment
Question by:moonrise
[X]
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
3 Comments
 
LVL 10

Expert Comment

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

type TGraph = class
x,y:integer;
procedures.......
procedure YourCreatedProcedureForOnClick;
OnCreate()...
begin
    yourtype.OnClick := YourCreatedProcedureForOnClick;
Inherited......
end;
procedure YourCreatedProcedureForOnClick;
begin
..your code goes here
end;
Viktor Ivanov
0
 

Accepted Solution

by:
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)



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

Let me know if it works.
0
 

Author Comment

by:moonrise
ID: 1357955
Thank you, it works great.
0

Featured Post

Independent Software Vendors: 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

Suggested Solutions

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…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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