Recent

Author Topic: Problem compiling a GUI (form) with a TPSScript component on it.  (Read 624 times)

jamie

  • Hero Member
  • *****
  • Posts: 4915
Problem compiling a GUI (form) with a TPSScript component on it.
« on: September 06, 2021, 03:04:33 am »
I have reported an issue but I would like to know how others have done this ?

I dropped a TPSScript component on the form, implemented the "OnProcessDirective" and I can not compile it because it has a duplicated "Active" parameter which matches a "Active" parameter in the TFORMS unit.

 I really don't understand this because this Active parameter should not be causing hardship with the compiler due to where it is located.
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls,
  9.  uPSComponent, uPSUtils, uPSPreProcessor;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     PSScript1: TPSScript;
  17.     procedure PSScript1ProcessDirective(Sender: TPSPreProcessor;
  18.       Parser: TPSPascalPreProcessorParser; const Active: Boolean;
  19.       const DirectiveName, DirectiveParam: tbtstring; var Continue: Boolean);
  20.   private
  21.  
  22.   public
  23.  
  24.   end;
  25.  
  26. var
  27.   Form1: TForm1;
  28.  
  29. implementation
  30.  
  31. {$R *.lfm}
  32.  
  33. { TForm1 }
  34.  
  35. procedure TForm1.PSScript1ProcessDirective(Sender: TPSPreProcessor;
  36.   Parser: TPSPascalPreProcessorParser; const Active: Boolean;
  37.   const DirectiveName, DirectiveParam: tbtstring; var Continue: Boolean);
  38. begin
  39.   beep;
  40. end;
  41. end.
  42.  
  43.  

This looks more like a compiler issue but I can't tell. it will work in console mode because the forms is not there.
The only true wisdom is knowing you know nothing

Soner

  • Sr. Member
  • ****
  • Posts: 253
Re: Problem compiling a GUI (form) with a TPSScript component on it.
« Reply #1 on: September 06, 2021, 07:22:04 am »
Change the Parameter Active to AActive.
Don't forget it to change in your event-function too.

Please write in your bug report hat they should change in lazarus\components\PascalScript\Source\uPSComponent.pas the Event TPSOnProcessDirective to:
Code: Pascal  [Select][+][-]
  1.   TPSOnProcessDirective = procedure (
  2.                             Sender: TPSPreProcessor;
  3.                             Parser: TPSPascalPreProcessorParser;
  4.                             const AActive: Boolean;             // <----  CHANGE THIS
  5.                             const DirectiveName, DirectiveParam: tbtstring;
  6.                             Var Continue: Boolean) of Object;  // jgv    
  7.  

I could not make patch, because I am not familiar wit git. I don't know, how to create a diff file with git.

PascalDragon

  • Hero Member
  • *****
  • Posts: 3398
  • Compiler Developer
Re: Problem compiling a GUI (form) with a TPSScript component on it.
« Reply #2 on: September 06, 2021, 09:20:59 am »
I really don't understand this because this Active parameter should not be causing hardship with the compiler due to where it is located.

Mode ObjFPC does not allow you to use the same name for a parameter of a method as for a field or property of the class it belongs to.

I could not make patch, because I am not familiar wit git. I don't know, how to create a diff file with git.

Most simple case: do your changes and do

Code: [Select]
git diff > my-patch.diff
To be sure that nothing unrelated is contained in there you can do a

Code: [Select]
git add path/to/file
for each relevant file and then do a

Code: [Select]
git diff --staged > my-patch.diff
Once you're satisfied you do a

Code: [Select]
git reset
To discard the staged changes and for each modified file you no longer need you do a

Code: [Select]
git checkout -- path/to/file
If you want to discard everything you do a

Code: [Select]
git reset --hard

jamie

  • Hero Member
  • *****
  • Posts: 4915
Re: Problem compiling a GUI (form) with a TPSScript component on it.
« Reply #3 on: September 06, 2021, 09:51:03 pm »
If i could remove my message totally from here I would but it seems I can't..

Although the TPSScript component gets  installed by default when installing Laz for the first time it has been deemed that it's not part of the lazarus distribution and gets pointed to a Github site and thus gets closed. End of discussion.


 Excuse me for trying to help..

 have a good day..




The only true wisdom is knowing you know nothing

Bart

  • Hero Member
  • *****
  • Posts: 4472
    • Bart en Mariska's Webstek
Re: Problem compiling a GUI (form) with a TPSScript component on it.
« Reply #4 on: September 06, 2021, 10:16:08 pm »
In the README.lazarus.txt:
Quote
In case of any issues you are advised to check the original distribution at https://github.com/remobjects/pascalscript/

Bart

 

TinyPortal © 2005-2018