Solved

Inhertied an event

Posted on 2000-04-08
7
393 Views
Last Modified: 2010-04-04
Hi

I have made a component with TStringGrid as anchestor. In my component I want to get an event to the OnSelectCell event, but I can't override it, because there is another function called SelectCell in TStringGrid. What is the trick here.
0
Comment
Question by:koger
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:ITugay
ID: 2695920
TYourGrid = class(TStringGrid)
.......
function SelectCell(ACol, ARow: Longint): Boolean; override;
......
end;

function TYourGrid.SelectCell(ACol, ARow: Longint): Boolean;
begin
    // do what you need here  
    //.......
    innerited;
end;


-----
Igor
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2695922
sorry typo...
.....

    //.......
    inherited;
end;
----
Igor.
0
 

Author Comment

by:koger
ID: 2695948
No I wanted to override the event not the function, sorry
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 9

Expert Comment

by:ITugay
ID: 2695962
Then override it. Just declare it in published part and write your own methods to write and read its handleaddress.

property OnSelectCell : TYourEvent read YourGetProc write  YourSetProc;

-----
Igor.
0
 

Author Comment

by:koger
ID: 2696032
Then I wouldn't give me any event in the derived class
0
 
LVL 9

Accepted Solution

by:
ITugay earned 50 total points
ID: 2696069
Of course, you need to do it manually, for example by overriding method in ancestor:

function TYourGrid.SelectCell(ACol, ARow: Longint): Boolean;
begin
   if Assigned(OnSelectCell)
     then OnSelectCell(YourParameters);
   result:=innerited(aCol,aRow);
end;

-----
Igor.
0
 

Author Comment

by:koger
ID: 2696101
:-)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

13 Experts available now in Live!

Get 1:1 Help Now