Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Forms Inheritance for Delphi 5... easy points?

Posted on 2003-03-26
5
Medium Priority
?
588 Views
Last Modified: 2010-04-16
A rookie question, in two parts....

1) I've designed a form which will be needed several times later so I'd like to use inheritance to be able to enrich the inherited forms. The only problem is that the layout on the inherited form doesn't appear on the delphi 5 editor window, it seems to be empty but if I run it I have the layout of the master form... How to fix that to be able to see the inheritated layout?

2) I've try to add the master form to the object repository but it don't offer me the possibility to use inheritance afterwards (the bullet is grey, I can only do a copy). Why?

Thx

MaNu
0
Comment
Question by:usa4manu
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:mocarts
ID: 8210622
first check you have both files pas and dfm for your form..
next - ensure you have open project when trying to create new inherited form.

two ways to inherit a form without adding it to repository:
1a- create new form, add components you need and save.
1b- create new form, add to uses clause parent forms unit and change class declaration to be inherited from your parent form.
examp.
  type
    TForm2 = class(TForm1)
    ..
1c- edit inherited forms dfm (by pressing alt+f12 when form is visible) and change in first row object to inherited, press alt+f12 and there must be all of your parent components.

easiest:
2a- see 1a
2b- choose File | New.. find a tab named by your project name (Project1 for examp.) and choose your new form to inherit from existing form in your project.

wbr, mo.
0
 

Author Comment

by:usa4manu
ID: 8216836
I've a problem remaining with the 1c...

Could U give me an example? Thx
0
 
LVL 9

Expert Comment

by:mocarts
ID: 8216854
in design mode right click form and choose View As Text menu item, you will see something like this:

object Form2: TForm2
Caption = '..'
..
end

change 'object' to 'inherited':
inherited Form2: TForm2
..
end

press Alt+F12 or by rightclicking in editor chose View As Form. that's all - you must see your new child form :)

wbr, mo.
0
 
LVL 9

Accepted Solution

by:
mocarts earned 1200 total points
ID: 8216870
note: both forms must be added to active Project or otherwise Delphi will not find your parent form.. generally your parent form must been added to project whenever you uses inherited forms.
0
 

Author Comment

by:usa4manu
ID: 8217843
Thx! 50 more for the quick answer! CU MaNu
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

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…
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 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…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

581 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