FWIW I too did not receive the original message. This list has got problems
Gary!
Carl Reynolds
<[EMAIL PROTECTED] To: Multiple recipients of list delphi
<[EMAIL PROTECTED]>
om.au> cc:
Sent by: Subject: RE: [DUG]: Registering
classes
owner-delphi@del
phi.org.nz
23/05/00 16:19
Please respond
to delphi
Thanks for the reply. Unfortunately despite assurances to the contrary,
mail is still flakey here (yours is the only DUG message I received today,
Myles - I never received that message from me that you replied to, for
example), so I'd best save my questions for tomorrow.
Ciao for now,
Carl
-----Original Message-----
From: Myles Penlington [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 23 May 2000 1:02 PM
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Registering classes
Bascially a class reference to your object must be in you compiled base
code. Ie you need to put a RegisterClass in the compiled code for every
class that could be in the DFM file.
Normally in this case we would have something like this.
initialization
RegisterClass( TABC );
end.
> -----Original Message-----
> From: Carl Reynolds [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, May 23, 2000 2:25 PM
> To: Multiple recipients of list delphi
> Subject: [DUG]: Registering classes
>
> I'm streaming out some forms and reading them back in at a later date.
My
> problem is that before reading them in, RegisterClass needs to be called
> for
> all of the classes of the components I'm reading (assuming these classes
> aren't already registered). So,
>
> 1/. Is there any reason why I can't just write out some class
definitions
> before writing my forms, and before reading them in again, read and
> register
> the classes, eg.
> // Write out
> var MyClass: TPersistentClass;
> MyClass := TButton;
> MyStream.Write(MyClass, SizeOf(TPersistentClass));
> // Read in
> MyStream.Read(MyClass, SizeOf(TPersistentClass));
> RegisterClass(MyClass);
> ?
>
> 2/. Is there an easier way than the following to get the class of an
> object
> (and is this method ok)?
> type
> TClassDef = class(TPersistent)
> class function GetClass: TPersistentClass;
> end;
> function TClassDef.GetClass: TPersistentClass;
> begin
> Result := Self;
> end;
> (eg, MyClass := TClassDef(Button1).GetClass;)
>
> I don't know much about the internal structure of a
> TClass/TPersistentClass,
> so I don't know if these sorts of things are "safe". I imagine that I'm
> making the assumption that the class definitions aren't different in the
> program that's reading them in, but I don't know whether that's a
> dangerous
> assumption to make. Is there a better way to do this?
>
> (Incidently, has mail been bouncing from my address? Apologies if so, on
> behalf of the installers of the new firewall here, which it seems was a
> little too efficient - I've had no mail all morning anyway)
>
> Cheers,
> Carl
>
>
--------------------------------------------------------------------------
> -
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz