Creating a Custom Component

I am trying to create a custom component using the method shown here; however the below methods are not visible to the compiler as it needs access to the WebLib.Controls unit which is found in the "\Control Source" subdirectory. By default the TMS Webcore installation adds "\Component Library Source" to the Library Path but the version of WebLib.Controls found in this location does not have a TCustomControl type with the below methods to override. If I add "\Control Source" to the project search path, then the project compiles but Code Insight is broken. Can anyone help me through this conundrum?

function GetOuterWidth: integer; override;
function GetOuterHeight: integer; override;
function CreateElement: TJSElement; override;
procedure UpdateElementVisual; override;
procedure UpdateElementData; override;
procedure CreateInitialize; override;

"Component Library Source" is used for the design-time and for code completion.

"Core Source" is what is used by the pas2js compiler.

Technically, these 6 methods are not needed at design-time, so these would only be useful to make the code-completion happy.

We added these methods as stubs so, with the next update, code-completion will also be happy for these.

Thanks Bruno, my own tinkering eventually lead me to this same conclusion. Is the expectation/hope that there is (eventually) 100% parity between the "Core Source" and the stubs in the "Component Library Source", or are you only adding the missing items if requested? Also I will be interested where you add the stubs, as I assume you won't be adding them directly on TControl inside the VCL.Controls unit?

I think I may have answered my own question. I assume I should actually be inheriting from TWebCustomControl instead of TCustomControl as per the blog article? And the stubs of missing procedures should be added to TWebCustomControl.

TWebCustomControls is recommended and we'll look to further add stubs

Awesome, could I put in a request for a few extras in addition to the above that I needed while developing my control. I've already made stubs of my own but they will obviously dissappear whenever a new version of TMSWebCore is installed.

on TWebCustomControl:
function HandleDoWheel(Event: TJSWheelEvent): Boolean; override;
function HandleDoDblClick(Event: TJSMouseEvent): Boolean; override;
function HandleDoMouseDown(Event: TJSMouseEvent): Boolean; override;
function HandleDoMouseUp(Event: TJSMouseEvent): Boolean; override;
function HandleDoMouseMove(Event: TJSMouseEvent): Boolean; override;
function HandleDoTouchStart(Event: TJSTouchEvent): Boolean; override;
function HandleDoTouchMove(Event: TJSTouchEvent): Boolean; override;
function HandleDoTouchEnd(Event: TJSTouchEvent): Boolean; override;
procedure BindEvents; override;

on TJSWindow:
function fetch(resource: String; init: TJSObject): TJSPromise; overload;
[async] function fetch(resource: String): TJSResponse; overload;
function fetch(resource: String): TJSPromise; overload;
function fetch(resource: TJSObject; init: TJSObject): TJSPromise; overload;
function fetch(resource: TJSObject): TJSPromise; overload;

which pulls in the following classes:
TJSResponse = class(TJSBody)
TJSBody = class(TJSObject)
TJSWritableStream = class(TJSObject)
TJSReadableStream = class(TJSObject)

We internally extended it for further compatibility.
Next update will have these extensions.

Fantastic. Thanks.