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.
Regards,
Adriaan van Os
__
In addition to what Martin said: as long as you have a non-static class
method the value of the variable you call the class method on (e.g.
myClass in your example) will be passed as Self parameter. So no need
for extra parameters.
But how can myClass be passed ?
myClass.CreateNew
Adriaan van Os via fpc-pascal schrieb am
Mi., 1. Mai 2024, 17:07:
> Suppose I have a
>
> var myClass: TClass
>
> and (for example) a
>
> class function TWindow.CreateNewWindow( )
>
> Now I want to call CreateNewWindow for var myClass. Of course, depending
> on the class,
> Cre
On 01/05/2024 16:28, Adriaan van Os via fpc-pascal wrote:
Suppose I have a
var myClass: TClass
and (for example) a
class function TWindow.CreateNewWindow( )
Now I want to call CreateNewWindow for var myClass. Of course,
depending on the class, CreateNewWindow will behave differen
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( );
___
fpc-pascal maillist - fpc-pascal@lists.freepas
Suppose I have a
var myClass: TClass
and (for example) a
class function TWindow.CreateNewWindow( )
Now I want to call CreateNewWindow for var myClass. Of course, depending on the class,
CreateNewWindow will behave different. Type-casting myClass to TWindow crashes (in my s