Custom control

How can I register my own custom control?l

Is this an FNC based web enabled control? 

If so, you need to register it just like you would register a VCLcontrol and you need to put the following attribute on the control:
[ComponentPlatforms(TMSWebPlatform)]

If this is a regular web control, you need to create a VCL stub class with attribute   [ComponentPlatforms(TMSWebPlatform)] and register that for VCL and put the actual control code in the library path of TMS WEB Core. 


I need a regular web control.

Do you have a file example with register procedure ?

When I put in the line "[ComponentPlatforms(TMSWebPlatform)]" I get a syntax error

The attribute [ComponentPlatforms(TMSWebPlatform)] belongs on the stub you install in the IDE, not on the control class that is compiled in the. Please have a look at the sources in the folder Component Library Source vs the ones in Core Source.

What is a stub?

And again: please send me an example-file of a custom visual component.

A stub class is the class that gets used at design time. Design-time, there is a Win32 VCL environment, not a web HTML environment, hence the need for a stub class.
A full sample for a HTML based custom control is described here:

https://www.tmssoftware.com/site/blog.asp?post=449

This was not a full sample.

These are only fragments of a file.

With these examples I can't register my component.



My question is: Which actions I have to make to register my component?



I allready made this file in my new web-package:



==============================================================

unit wImageButton;



interface



uses Classes, WEBLib.Controls, Web;



Type

[ComponentPlatformsAttribute(TMSWebPlatform)]

TWebImageButton = class(TCustomControl)

private

protected

published

end;



procedure register;



implementation



procedure Register;

begin

RegisterComponents('Custom Webcontrols', [TWebImageButton]);

end;



end.

=====================================================



I could compile and install the package.

In my program I put the component on a form, but when i compiled I get the error:

"could not find unit "wImageButton"



What do I have to do?

What you have created here is the stub class for design-time use (used in the IDE, compiled in the IDE)
You now need to have the same class for runtime use on the web in the "Core Source" folder or another folder that is included in your Pascal to Javascript compiler library path.

Where can I change the "Pascal to Javascript compiler library path"?

How do I add my own properties in design-time?

Do I register with RegisterComponents from System.Classes Or WEBLib.DesignIntf ?

Settings for the Pascal to Javascript compiler are under IDE Tools, Options, TMS Web

Design-time properties are added to the stub class
You only need to register components for design-time with RegisterComponents() from system.Classes