Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

two simple inheritance questions

Posted on 2006-07-19
2
Medium Priority
?
200 Views
Last Modified: 2010-04-05
Hello there...two simple questions.

I'm making a tabbed text editor. So, multiple files are open at the same time. Ok, now I realised that inheriting a new richeedit would be just great to solve some problems: know the complete file name of the text file opened in each tab, know if text is saved or if it contains modifications that were not saved.

However, when I sat to do this..I found out it was not as easy as I supposed. First question: how do I override a property? specially if it´s an event. For example, RichEdit's OnChange event. I would like to do something and then let the inherited OnChange do it's part. Second question: how do I override a Richedit's Line.Save/LoadToFile properties? I mean, they are not simple methods that correspond directly to the Richedit class..they correspond to an object incorporated to that class.

Examples (even if they are short) would be greatly appreciated!

thanx in advance,
paul.
0
Comment
Question by:pin_plunder
[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
2 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 100 total points
ID: 17144289
Use frames instead. Create a new frame, give it the additional properties that you like and on your TabControl all you have to do is add new frames of this frame class. Much less complicated than having to make a new TRichEdit class.
0
 
LVL 6

Assisted Solution

by:House_of_Dexter
House_of_Dexter earned 100 total points
ID: 17146751
k...for one you don't want to override the functionality of Line...that is decendended from TStrings and is tied into TCustomMemo...

You want to override TRichEditStrings and add a new functionality there...you will need to override the constructor and create a new TRichEditStrings...


OR

just expose the Methods you want...  TMyRichEditStrings.LoadToFile and TMyRichEditStrings..SaveLine.

Now on to your OnChange...

first redeclare the OnChange property

private
  FOnChangeNew: TNotifyEvent;
protected
  procedure DoChange(Sender: TObject);
public

Property OnChange: TNotifyEvent read FOnChangeNew write FOnChangeNew;


constructor Create
....
  Self.OnChange := DoChange;


procedure TMyRichEditStrings.DoChange(Sender: TObject);
begin
  //  Do my expanded changes here...
  if Assigned(FOnChangeNew) then
    FOnChangeNew(Self);
end;
 
0

Featured Post

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!

Question has a verified solution.

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

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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

609 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