hometagsloginregister

Ready to Participate?
Ready to Participate?
Get Started!
Log In

Lazarus pascal dialog help needed
This is the part of my code that's messed up.

procedure TForm1.OpenMenuItemClick(Sender: TObject);
begin
TForm1.OpenDialog1.Execute();
end;

It tells me "Error: Only class methods can be referred with class references". Do you have any solutions I can try out?
asked in computer, programming, pascal



Leohuberh answers:

This error occurs in a situation like the following:
Type :
Tclass = Class of Tobject;
Var C : TClass;
begin
...
C.free
Free is not a class method and hence cannot be called with a class reference.
Error: Only class methods can be accessed in class methods
This is related to the previous error. You cannot call a method of an object from inside a class method. The following code would produce this error:
class procedure tobject.x;
begin
free

Because free is a normal method of a class it cannot be called from a class method.

http://www.freepascal.org/docs-html/user/userse62.html


/ reply

Comments


No Comments