[Pas2js] Before compile Notifier to the pas2jsdesign plugin
Mattias Gaertner
nc-gaertnma at netcologne.de
Sat Mar 24 08:40:51 CET 2018
On Fri, 23 Mar 2018 23:09:13 -0500 (CDT)
warleyalex via Pas2js <pas2js at lists.freepascal.org> wrote:
> In Delphi, using Open Tools API, it is possible form notifiers that fire
> notifications for BeforeSave or AfterSave. One can AddNotifier and watch for
> notifications directly from the IDE plugin:
>
> TIdeNotifier = class(TNotifierObject, IOTANotifier, IOTAIDENotifier)
> protected
> procedure AfterCompile(Succeeded: Boolean);
> procedure BeforeCompile(const Project: IOTAProject; var Cancel:
> Boolean);
> procedure FileNotification(NotifyCode: TOTAFileNotification;
> const FileName: string; var Cancel: Boolean);
> end;
>
> The plan would be to implement an IDE notifier to the Lazarus pas2jsdesign
> plugin. For instance, before compile, I want to fire the method
DFMTOPAS.
Here are the IDE events:
http://wiki.freepascal.org/Extending_the_IDE#Project_events
> As
> I was stuck on this “Plan A”, I will try the plan B, which is a simple menu
> button to call DFMTOPAS manually, this DFMTOPAS method is
> (component-to-code) will translate ALL "instantiated" and "unassigned" forms
> as well in the current project to pascal code, then I will add this
> directive.
What are "instantiated" and "unassigned" forms?
> procedure TForm1.LoadDFMValues;
> begin
> inherited;
> { $I Form1.lfm.inc }
>
> //{ $I %form% }
>
> end;
>
> Any thoughts on this.
Note that a LFM might need units, not in the uses clause. The IDE only
adds the units for the used component classes, not for the used
property values. So compiling might fail.
The TCompWriterPas has the full list of required units in the property
NeededUnits.
Mattias
More information about the Pas2js
mailing list