What does the {$IFNDEF LCLTMSWEB} compiler directive mean?

71 views Asked by At

I'm looking through the WEBLib.StdCtrls source code in TMS Web Core and regularly I see a {$IFNDEF LCLTMSWEB} compiler directive such as here with the TWebLabel component:

{$IFNDEF LCLTMSWEB}
[ComponentPlatforms(TMSWebPlatform)]
{$ENDIF}
TWebLabel = class(TWebCustomLabel)
private
  FOnTouchMove: TTouchEvent;
  FOnTouchStart: TTouchEvent;
  FOnTouchEnd: TTouchEvent;
  FOnTouchCancel: TTouchEvent;
published
  property Align;
  property Alignment;
  {$IFNDEF LCLTMSWEB}
  property AlignWithMargins;
  {$ENDIF}
  property Anchors;
  property AutoSize;
  property Caption;
  property ChildOrder;
  property Color;
  property DragMode;
  property ElementClassName;
  property ElementLabelClassName;
  property ElementID;
  property ElementFont;
  property ElementPosition;
  {$IFNDEF LCLTMSWEB}
  property EllipsisPosition;
  {$ENDIF}
  property Enabled;
  property FocusControl;
  property Font;
  property Height;
  property HeightStyle;
  property HeightPercent;
  property Hint;
  property HTML;
  property HTMLType;
  property Layout;
  property Left;
  {$IFNDEF LCLTMSWEB}
  property Margins;
  {$ENDIF}
  property ParentFont;
  property PopupMenu;
  property Role;
  property ShowAccelChar;
  property ShowHint;
  property TextDirection;
  property Top;
  property Transparent default true;
  property Visible;
  property Width;
  property WordWrap;
  property WidthStyle;
  property WidthPercent;
  property OnClick;
  property OnDblClick;
  property OnMouseDown;
  property OnMouseMove;
  property OnMouseUp;
  property OnMouseLeave;
  property OnMouseEnter;
  property OnTouchStart: TTouchEvent read FOnTouchStart write FOnTouchStart;
  property OnTouchEnd: TTouchEvent read FOnTouchEnd write FOnTouchEnd;
  property OnTouchMove: TTouchEvent read FOnTouchMove write FOnTouchMove;
  property OnTouchCancel: TTouchEvent read FOnTouchCancel write FOnTouchCancel;
  property OnDragDrop;
  property OnDragOver;
  property OnEndDrag;
  property OnStartDrag;
end;

You'll see the following in various places:

{$IFNDEF LCLTMSWEB}
  // Some code for the compiler directive
{$ENDIF}

What is LCLTMSWEB and what does the {$IFNDEF LCLTMSWEB} compiler directive check for?


LCL = Lazarus?

So does the following line mean that the AlignWithMargins and Margins properties aren't available in Lazarus for TMS Web Core, but is available in all other platforms?:

{$IFNDEF LCLTMSWEB}
property AlignWithMargins;
{$ENDIF}

and

{$IFNDEF LCLTMSWEB}
property Margins;
{$ENDIF}

So if you're using Lazarus with TMS Web Core, can you not set margin properties?


Maybe another side question if the above is true:

Why would some properties be available in Delphi, but not in Lazarus? Since TMS Web Core simply compiles the Object Pascal to JavaScript. Why can't the properties be available in both?

0

There are 0 answers