Solved

Adding OnClick Event to TGraphicControl descendent

Posted on 1998-07-15
3
860 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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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