Re: How do I change a Form ancestor type.
From: Bjørge Sæther (bjorge_at_hahaha_itte.no)
Date: 01/22/04
- Next message: jimmy: "Re: MDI in DLL"
- Previous message: Bjørge Sæther: "Re: Invalid variant type conversion"
- In reply to: Phil Grace: "Re: How do I change a Form ancestor type."
- Next in thread: Phil Grace: "Re: How do I change a Form ancestor type."
- Reply: Phil Grace: "Re: How do I change a Form ancestor type."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 22 Jan 2004 01:43:59 +0100
Phil Grace wrote:
> On Wed, 21 Jan 2004 19:17:17 +0000 (UTC), erewhon@nowhere.com (J
> French) wrote:
>
>> On 21 Jan 2004 08:42:13 -0600, Phil Grace <phil@niche-cs.com> wrote:
>>
>>> ENV : Delphi 7
>>>
>>> Hi I have a project with quite a few forms, all derived from TForm.
>>> What I would like to do is create a TBaseForm (derived from TForm),
>>> put some common functionality in it, and have all my other forms
>>> derive from TBaseForm rather than TForm.
>>
>> Sensible
>>
>>>
>>> I've tried to do this by simply using a text editor (outside of
>>> Delphi) to change the class of the form to TBaseForm, but this seems
>>> to have no effect (it even compiles ok, but doesn't inherit the
>>> "middle" form).
>>>
>>
>> What ????
>
>
> Ok.... so lets say I used to have TMyForm ->TForm, and that what I
> want is TMyForm -> TBaseForm -> TForm !
>
> What I did was create TBaseForm and put some stuff in there... notably
> visual components that would let me see immediately when it worked.
> Then I edited TMyForm to inherit from class TBaseForm instead of
> TForm. This seems to have NO effect whatsoever. Non of the visual
> components in TBaseForm show up, and the app compiles without error !
>
>
>>
>>> How can I do this without building all my forms from the gound up.
>>
>> Just create a Unit
>> ... but I suggest that you try simpler things first
>
> Yes, I can do that, but my point is that I already have a ton of forms
> that I want to change the class of, and don't want to manually
> re-create each one with a new unit based on TBaseForm.
Here's what is found in a .dfm file of an inherited form:
inherited frmAdressat: TfrmAdressat
Left = 397
Top = 375
Width = 785
Height = 465
Caption = 'Adressat: Adressatdata'
PixelsPerInch = 96
TextHeight = 13
inherited Panel1: TPanel
Width = 777
Height = 419
inherited PageControl1: TPageControl
Width = 777
Height = 419
ActivePage = tbshtDetalj
inherited tbshtOversikt: TTab***
inherited DBGrid1: TDBGrid
Width = 769
Height = 391
PopupMenu = PopupStdFilter
OnCellClick = DBGrid1CellClick
OnMouseMove = DBGrid1MouseMove
end
end
...you see the difference ? 'inherited' BlaBlaBla is referring to a
component in the ancestor form, while 'object' is a component inserted in
the current form class.
It would probably be possible to modify this in a text editor, but it may be
a lot of work. And...do take a backup first....;-)
-- Regards, Bjørge Sæther bjorge@haha_itte.no ------------------------------------- I'll not spend any money on American Software products until armed forces are out of Iraq.
- Next message: jimmy: "Re: MDI in DLL"
- Previous message: Bjørge Sæther: "Re: Invalid variant type conversion"
- In reply to: Phil Grace: "Re: How do I change a Form ancestor type."
- Next in thread: Phil Grace: "Re: How do I change a Form ancestor type."
- Reply: Phil Grace: "Re: How do I change a Form ancestor type."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]