Solved

Adding OnClick Event to TGraphicControl descendent

Posted on 1998-07-15
3
835 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
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

20 Experts available now in Live!

Get 1:1 Help Now