[Pas2js] TObject.Dispatch messages
    warleyalex 
    warleyalex at yahoo.com.br
       
    Sun Mar 17 13:03:52 CET 2019
    
    
  
I can not test the "Dispatch messages" feature in the Pas2JS Compiler version
1.4.0RC7 [2019/03/16] for Win32 i386.
I've got unit4.pas(29,27) Error: not yet implemented: :TPasProcedureType
[20170208142159] modifier message
[code]
unit Unit4;
{$mode objfpc}{$H+}
interface
uses
  Classes, SysUtils;
type
  TMyComponent = class
    {$DispatchField Msg} // enable checking message methods for record field
name "Msg"
    procedure Dispatch(var aMessage); virtual;
    {$DispatchStrField MsgStr}
    procedure DispatchStr(var aMessage); virtual;
  end;
  TMouseDownMsg = record
    Msg: DWord; // Id instead of Msg, works in FPC, but not in pas2js
    x,y: DWord;
  end;
  TMouseUpMsg = record
    MsgStr: string;
    X,Y: DWord;
  end;
  { TWinControl }
  TWinControl = class
    procedure MouseDownMsg(var Msg: TMouseDownMsg); message 3; // warning:
Dispatch requires record field Msg
    procedure MouseUpMsg(var Msg: TMouseUpMsg); message 'up'; // ok, record
with string field name MsgStr
  end;
implementation
{ TWinControl }
procedure TWinControl.MouseDownMsg(var Msg: TMouseDownMsg);
begin
end;
procedure TWinControl.MouseUpMsg(var Msg: TMouseUpMsg);
begin
end;
end.    
[/code]
--
Sent from: http://pas2js.38893.n8.nabble.com/
    
    
More information about the Pas2js
mailing list