Plain string constants.
-----Original Message-----
From: David Brennan [mailto:[EMAIL PROTECTED]
Sent: Thursday, 6 March 2003 11:21 a.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: [Q] Visual Form Inheritance [VFI]

Myles,
 
Out of curiousity, are FormUnitSource and FormDfmSource functions which simply return predefined string constants or are you loading the strings from somewhere?
 
David.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Myles Penlington
Sent: Thursday, 6 March 2003 10:57 AM
To: Multiple recipients of list delphi
Subject: RE: [DUG]: [Q] Visual Form Inheritance [VFI]

VFI works very well, however for it to work correctly, you need a designtime package that includes your Form and have it registered with Delphi.
 
eg  You always need some code like the following in a package/expert.
 
  TMyFormExpert = class(TIExpert)
  public
    function GetName: string; override;
    function GetComment: string; override;
    function GetGlyph: HICON; override;
    function GetStyle: TExpertStyle; override;
    function GetState: TExpertState; override;
    function GetIDString: string; override;
    function GetAuthor: string; override;
    function GetPage: string; override;
    function GetMenuText: string; override;
    procedure Execute; override;
  end;
procedure Register;
begin
  RegisterCustomModule( TMyForm, TCustomModule);
  RegisterLibraryExpert( TMyFormExpert.Create);
end;
procedure TMyFormExpert.Execute;
var
  UnitIdent,
  Filename,
  FormName    : string;
  CodeStream  : IStream;
  DFMStream   : IStream;
  DFMString,
  DFMVCLStream: TStream;
begin
  if not ToolServices.GetNewModuleAndClassName( 'MyForm', UnitIdent, FormName, FileName ) then Exit;
 
  CodeStream := TIStreamAdapter.Create( TStringStream.Create(Format(FormUnitSource, [UnitIdent, FormName])), soOwned );
  DFMString  := TStringStream.Create(Format(FormDfmSource, [FormName]));
  try
    DFMVCLStream := TMemoryStream.Create;
    try
      ObjectTextToResource( DFMString, DFMVCLStream);
      DFMVCLStream.Position := 0;
    except
      DFMVCLStream.Free;
      Exit;
    end;
    DFMStream := TIStreamAdapter.Create( DFMVCLStream, soOwned );
 
    ToolServices.CreateModuleEx(FileName, FormName, 'TMyForm', '', CodeStream, DFMStream, [cmAddToProject, cmShowSource, cmShowForm, cmUnNamed, cmMarkModified]);
  finally
    DFMString.Free;
  end;
end;
 
Myles
 
-----Original Message-----
From: Donovan J. Edye [mailto:[EMAIL PROTECTED]
Sent: Thursday, 6 March 2003 10:43 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: [Q] Visual Form Inheritance [VFI]

G'Day,

I have been using visual form inheritance for a project and have a couple of
questions.

1. Why do I have to do a New... and select the base form from the "MyProject" tab?

If I have a form declared as TMyBaseForm and I do a New Form, why can't I just
change the inhertited class in the new unit? ie

TMyNewForm = class(TForm) becomes TMyNewForm = class(TMyBaseForm). If I do this
by hand then "Revert To Inherited" is not available. So what else is Delphi doing
behind the scenes?


2. A TImageList on the base form does not update on the descendant child forms when
new images are added. Why? Are certain controls not VFI supported?

3. Using DevExpress Bars for my toolbar does not reflect on the descendant children.
How are customised toolbars handled with VFI? Do children have to drag their buttons
on?

What other gotchas are there with VFI? Any comments, references etc. appreciated.

-- Donovan
----------------------------------------------------------------------
Donovan J. Edye [
www.edye.wattle.id.au]
Namadgi Systems [
www.namsys.com.au]
Voice: +61 2 6285-3460
Fax: +61 2 6285-3459
TVisualBasic = Class(None);
Heard just before the 'Big Bang': "...Uh Oh...."
----------------------------------------------------------------------
GXExplorer [
http://www.gxexplorer.org] Freeware Windows Explorer
replacement. Also includes freeware delphi windows explorer components.
----------------------------------------------------------------------

Reply via email to