 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andy Hill Guest
|
Posted: Tue Oct 07, 2003 9:37 am Post subject: EResNotFound in component derived from TForm? |
|
|
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
|
Posted: Tue Oct 07, 2003 5:07 pm Post subject: Re: EResNotFound in component derived from TForm? |
|
|
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 |
|
 |
|
|
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
|
|