Before I go any further, and please someone correct me if I'm wrong
because I don't use packages or even DLL's much and also don't write
components, but is the public method you are declaring and calling to get
the classname applicable to both your TFrameClass and it's ancestor the
TFrame class? And, do you really need to write this method? Looking at the
help the TFrame class inherits a public method from Tpersistent,
"ClassName", so your TFrameclass should as well shouldn't it?
I've never used a method of my own that way so perhaps it's quite
all right, but I doubt very much I would have attempted to write it this way
myself. I would have initialized my Frame1 and/or fram as a TFrameclass not
a TFrame...if indeed I wanted to be able to use methods of the TFrameClass I
wrote . Are you getting any actual error messages or is it simply not
showing?
from Robert Meek dba Tangentals Design CCopyright 2006
"When I examine myself and my methods of thought, I come to the conclusion
that the gift of Fantasy has meant more to me then my talent for absorbing
positive knowledge!"
Albert Einstein
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Horváth Márton
Sent: Saturday, February 11, 2006 6:15 AM
To: [email protected]
Subject: TFrame in package (fwd)
>> Sorry I can't be more helpful. Perhaps if you posted some code?
I appreciate any idea! Here is the important parts of my code:
1., I made a package named "Package1" . I put a frame1 into it, and this
piece of code:
type
TFrameClass = class of TFrame; // this TFrameClass is common class to
factory other frames in future...
TFrame1 = class(TFrame)
...
// here is the public declaration of a simple function
// which returns with the proper class of frame:
function GetFrameClass:TFrameClass; stdcall;
implementation
...
function GetFrameClass:TFrameClass; stdcall;
begin
result:=TFrame1; // pass back the proper class of this frame
end;
exports
GetFrameClass;
initialization
RegisterClass(TFrame1);
finalization
UnRegisterClass(TFrame1);
2. Then I made a simple application wiht Button1:
// public references
hnd:HMODULE;
prc: function:TClassFrame; stdcall;
fram:TFrame;
...
procedure TForm1.Button1Click(Sender: TObject);
begin
hnd:= LoadPackage('Package1.bpl');
prc:=GetProcAddress(hnd,'GetFrameClass');
if Assigned(prc) then
fram:=prc.Create(Form1);
fram.parent:=Form1;
-------------------
I reach this point without any error. The frame has been created but
cannot be seen! If I do a bit of woodwork the frame can be forced to
shown (it's ridiculous):
eg.: Form1.Hide; Form1.Show;
OR: Form1.Perform(CM_VISIBLECHANGED,0,0);
OR: as I mentioned with Project/Options/Packages/"Build with runtime
packages" check, but I must avoid this way...
fram.show, visible:=True, etc, has NO ANY effect.
I cannot belive this is the proper way to solve this problem. I have
experienced this effect on D2005 and 7 as well. What the hell is it?
What do I wrong? (I'm gonna mad)
Thanks for advance:
m.
___________________________________________________________________________
"AZ ŐSKORBAN A HOMO SAPIENS 6-8 m2 ALAPTERÜLETŰ BARLANGBAN LAKOTT. A XXI.
SZÁZADBAN ÖNNEK MILYENEK AZ IGÉNYEI? " http://www.realisingatlan.hu
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk