On 02/05/2024 08:32, Adriaan van Os via fpc-pascal wrote:
Martin Frb via fpc-pascal wrote:

Silly question, but did you assign the value to the variable?

myClass := TWindow;

That's what I did.

TWindow(myClass).CreateNewWindow;

And this is what crashes. I can report this, if the type-cast is supposed to work.

My example (2nd part of it) was actually wrong.

It was mentioned before

On 01/05/2024 19:43, Jean SUZINEAU via fpc-pascal wrote:
I didn't tested but I imagine it could be done with something like this ?

type
       TWindow_Class= class of TWindow;
begin
          ...
          (myClass as TWindow_Class).CreateNewWindow( ....);

It must be cast to another "class of"
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to