Error SSImport importing classes with implements


Hello

I tried to import classes with the implements directive in the class and error occurs. Could you fix it or is there a way to avoid the error?

Error line:     

property aImplementsISMIDERunTimeInfo: IISMIDERunTimeInfo read  fISMIDERunTimeInfo write fISMIDERunTimeInfo implements IISMIDERunTimeInfo;

Complete code:

unit st4makers.Component.MyLabel;

interface

uses
  System.Classes, Vcl.StdCtrls,

  st4makers.Component.MyIDEComponent,
  st4makers.OPC.Item,
  st4makers.OPC.IReceiverItem,
  st4makers.IDE.RunTimeInfo,
  st4makers.IDE.Attributes;

type

  [IDEHINT('Simple label')]
  TMyLabel = class(TCustomLabel, IISMIDERunTimeInfo, IISMIDEComponent,
    IISMOPCReceiver)
  private
    fISMIDERunTimeInfo: IISMIDERunTimeInfo;

    property aImplementsISMIDERunTimeInfo: IISMIDERunTimeInfo read
    fISMIDERunTimeInfo write fISMIDERunTimeInfo
      implements IISMIDERunTimeInfo;
  strict protected
    procedure SourceChanged(MyOPCItem: TMyOPCItem);
  public
    constructor Create(Owner: TComponent); override;
    function ComponentHint: string;
  published
    property Align;
    property Alignment;
    property Anchors;
    property AutoSize;
    property BiDiMode;
    property Caption;
    property Color nodefault;
    property Constraints;
    property DragCursor;
    property DragKind;
    property DragMode;
    property EllipsisPosition;
    property Enabled;
    property FocusControl;
    property Font;
    property GlowSize; // Windows Vista only
    property ParentBiDiMode;
    property ParentColor;
    property ParentFont;
    property ParentShowHint;
    property PopupMenu;
    property ShowAccelChar;
    property ShowHint;
    property Touch;
    property Transparent;
    property Layout;
    property Visible;
    property WordWrap;
    property StyleElements;
    property OnClick;
    property OnContextPopup;
    property OnDblClick;
    property OnDragDrop;
    property OnDragOver;
    property OnEndDock;
    property OnEndDrag;
    property OnGesture;
    property OnMouseActivate;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
    property OnMouseEnter;
    property OnMouseLeave;
    property OnStartDock;
    property OnStartDrag;
  end;

implementation

uses
  ut_debugwindow, ISMIDERunTimeInfoUnit;

{ TMyLabel }

function TMyLabel.ComponentHint: string;
begin
  result := '';
end;

constructor TMyLabel.Create(Owner: TComponent);
begin
  inherited;

  aImplementsISMIDERunTimeInfo := TISMIDERunTimeInfo.Create;
end;

procedure TMyLabel.SourceChanged(MyOPCItem: TMyOPCItem);
begin
  if aImplementsISMIDERunTimeInfo.RunMode then
  begin
    Caption := MyOPCItem.ValueStr;
    if MyOPCItem.TheUnit <> '' then
      Caption := Caption + ' ' + MyOPCItem.TheUnit;
  end;
end;

end.

All the best
ilde

The import tool unfortunately doesn't cover 100% of Delphi syntax and in those cases you have to manually import the class. It's also worth noting that import tool is there since Delphi 5 (which we don't support anymore by the way) but at that time there wasn't the new RTTI.

Currently, in my opinion the best way to register classes in scripter is to use DefineClassByRtti (Delphi 2010 and up) and then manually registering the methods you might miss.