[Pas2js] External class with custom event

Michael Van Canneyt michael at freepascal.org
Mon May 22 12:32:32 CEST 2023



On Mon, 22 May 2023, Luca Olivetti via Pas2js wrote:

> El 22/5/23 a les 12:14, Luca Olivetti via Pas2js ha escrit:
>
>> It seems to work OK
>
> I forgot the Selected property and, while in the object (console.log(choice)) 
> I see it is true, console.log(choice.selected) shows false.
>
>
>  TChoice = class (TJsObject)
>  private
>    FActive: boolean; external name 'active';
>    FDisabled: boolean; external name 'disabled';
>    FElementId: string; external name 'elementId';
>    FgroupId: integer; external name 'groupId';
>    Fid: integer; external name 'id';
>    FKeyCode: integer; external name 'keyCode';
>    FLabel: string; external name 'label';
>    FPlaceholder: boolean; external name 'placeholder';
>    FScore:integer; external name 'score';
>    FSelected:boolean; external name 'selected';
>    FValue:string; external name 'value';
>  public
>    property Active:boolean read FActive;
>    property Disabled:boolean read FDisabled;
>    property ElementId:string read FElementId;
>    property GroupId:integer read FGroupId;
>    property Id:integer read FId;
>    property KeyCode:integer read FKeyCode;
>    property Label_:string read FLabel;
>    property Placeholder:boolean read FPlaceHolder;
>    property Score:integer read FScore;
>    property Selected:boolean read FSelected;
>    property Value:string read FValue;
>  end;

If the pascal declaration was wrong, then you would get 'undefined' for console.log(choice.selected)
so the error is somewhere else.

Michael.


More information about the Pas2js mailing list