BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

EResNotFound in component derived from TForm?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Andy Hill
Guest





PostPosted: Tue Oct 07, 2003 9:37 am    Post subject: EResNotFound in component derived from TForm? Reply with quote



Why does the following code give EResNotFound
exception?

type
TPlugIn= class(TForm)
end;

procedure TForm1.Button1Click(Sender: TObject);
var
PlugIn: TPlugIn;
begin
PlugIn:=TPlugIn.Create(Self);
PlugIn.Show;
end;

Back to top
Alexander Bauer
Guest





PostPosted: Tue Oct 07, 2003 5:07 pm    Post subject: Re: EResNotFound in component derived from TForm? Reply with quote



Hi Andy,

If I remember right I had the same problem once (long time ago). If you
create a Form, it alway need a DFM to read its properties, controls and
stuff. I overode the constructor of my TForm descentant like below to create
at simple, empty form without a DFM resource.

fOwner := aOwner;
Visible := false;
fForm := TForm(GetParentForm(TControl(aOwner))); // The owner is a
component of an other form. I used this to get the font and stuff of this
owner-form as defaults - see below.
GlobalNameSpace.BeginWrite;
try
CreateNew (aOwner);
BorderIcons := [];
BorderStyle := TFormBorderStyle(0);
ClientHeight := 100;
ClientWidth := 200;
Color := clBtnFace;
finally
GlobalNameSpace.EndWrite;
end;
OnKeyPress := KeyExit;
Font := fForm.Font;
PrintScale := fForm.PrintScale;
Scaled := fForm.Scaled;
OldCreateOrder := false;
PixelsPerInch := 120;
KeyPreview := true;
Width := 199; // No need to scale Size - is setted dynamically anyway
Height := 68;
Ctl3D := true;

I hope this can help you.

Regards,
Alexander Bauer


"Andy Hill" <zennews (AT) cairnwebnospam (DOT) com> schrieb im Newsbeitrag
news:3f828977$0$10970$fa0fcedb (AT) lovejoy (DOT) zen.co.uk...
Quote:
Why does the following code give EResNotFound
exception?

type
TPlugIn= class(TForm)
end;

procedure TForm1.Button1Click(Sender: TObject);
var
PlugIn: TPlugIn;
begin
PlugIn:=TPlugIn.Create(Self);
PlugIn.Show;
end;




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.