Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Inhertied an event

Posted on 2000-04-08
7
Medium Priority
?
404 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
[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
  • 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
Technology Partners: 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!

 
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 200 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

704 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