Solved

Inhertied an event

Posted on 2000-04-08
7
397 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 320
Process Javascript errors with Delphi TWebBrowser 1 178
TEMBEDDEDWB how can i change its user agent ? 8 70
CheckListBox usage 3 71
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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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