usa4manu
asked on
Forms Inheritance for Delphi 5... easy points?
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
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
ASKER
I've a problem remaining with the 1c...
Could U give me an example? Thx
Could U give me an example? Thx
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thx! 50 more for the quick answer! CU MaNu
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.