Recent

Author Topic: Can't set an TmenuItem.onclick event in property editor.  (Read 6091 times)

Andyk

  • Jr. Member
  • **
  • Posts: 72
Can't set an TmenuItem.onclick event in property editor.
« on: June 12, 2012, 02:17:00 pm »
When I try and set this, the IDE tries to do a syntax check of the whole project and fails on a new unit I have added which uses advanced delphi style records with operator overloading.

It tells me I have to fix this error first even though there is no error in the unit, fpc is happy to compile the unit and it runs OK.

Editor is v0.9.30.4 and fpc version 2.6.0

It seems the IDE syntax checker is not compatible with the fpc version being used.

This is the code it fails on

Quote
unit MComplex;
{$mode delphi}
interface

uses SysUtils,math;

type
  Tcomplex=record
      r,i:double;
    public
      function str:string;
      class operator Implicit(const AValue: Double): TComplex;
      class operator Implicit(const AValue: Integer): TComplex;
      class operator Implicit(const AValue: Int64): TComplex;
      class operator Add(const Left, Right: TComplex): TComplex;
      class operator Subtract(const Left, Right: TComplex): TComplex;
      class operator Multiply(const Left, Right: TComplex): TComplex;
      class operator Divide(const Left, Right: TComplex): TComplex;
      class operator Negative(const AValue: TComplex): TComplex;
      class operator Equal(const Left, Right: TComplex): Boolean;
      class operator NotEqual(const Left, Right: TComplex): Boolean;
   end;

It doesn't understand the first "function" after "public" says ":" expected.

Any workarounds ?
« Last Edit: June 12, 2012, 02:22:59 pm by Andyk »

Andyk

  • Jr. Member
  • **
  • Posts: 72
Re: Can't set an TmenuItem.onclick event in property editor.
« Reply #1 on: June 12, 2012, 10:11:58 pm »
The file also fails the tools/quick syntax check.

This looks like an IDE bug and the codetools syntax checker is not compatible with fpc.

Can anyone verify this, I can't continue on with my project because it won't let me set any component event properties. This is seriously affecting me.

Is there any way to turn the syntax checker off?

joseme

  • Full Member
  • ***
  • Posts: 128
    • Logosoft sistemas
Re: Can't set an TmenuItem.onclick event in property editor.
« Reply #2 on: June 12, 2012, 10:53:33 pm »
If I try to compile your unit, it fails but the error is not the same. The first message lines are:

unit1.pas(13,16) Error: Forward declaration not solved "procedure str:AnsiString;"
unit1.pas(14,22) Error: Forward declaration not solved "operator :=(const Double):<record type>;"
unit1.pas(15,22) Error: Forward declaration not solved "operator :=(const LongInt):<record type>;"
unit1.pas(16,22) Error: Forward declaration not solved "operator :=(const Int64):<record type>;"
unit1.pas(17,22) Error: Forward declaration not solved "operator +(const Tcomplex;const Tcomplex):<record type>;"
unit1.pas(18,22) Error: Forward declaration not solved "operator -(const Tcomplex;const Tcomplex):<record type>;"
...
I am using Lazarus 1.1 Revision 37429, FPC 2.7.1
un aporte a la comunidad:
http://pascalylazarus.blogspot.com/

Andyk

  • Jr. Member
  • **
  • Posts: 72
Re: Can't set an TmenuItem.onclick event in property editor.
« Reply #3 on: June 12, 2012, 11:12:34 pm »
Yeah, I only included the header part of the file in the post, the FPC compiler has no problem with it, its a complex math unit I developed in Delphi, the program compiles and runs OK under lazarus.

The problem is I can't now add any more visual components on a form because the IDE syntax checker throws up an error in the code as detailed in the first post.

It looks like the IDE uses its own syntax checker/parser which it runs before it will allow any event properties to be added to components and it doesn't understand the advanced record structure.

Andyk

  • Jr. Member
  • **
  • Posts: 72
Re: Can't set an TmenuItem.onclick event in property editor.
« Reply #4 on: June 13, 2012, 12:23:17 pm »
I downloaded and, after much pain, managed to installed the 1.1 snapshot.

It seems this is fixed in Laz 1.1.

joseme

  • Full Member
  • ***
  • Posts: 128
    • Logosoft sistemas
Re: Can't set an TmenuItem.onclick event in property editor.
« Reply #5 on: June 13, 2012, 01:14:17 pm »
Glad to know that. Because I am very lazy, I adopted CodeTyphon several months ago.
un aporte a la comunidad:
http://pascalylazarus.blogspot.com/

 

TinyPortal © 2005-2018