Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Custom control

 Post Reply Post Reply
Author
Schoonhoven Gerrit View Drop Down
New Member
New Member
Avatar

Joined: 24 Sep 2017
Posts: 6
Post Options Post Options   Quote Schoonhoven Gerrit Quote  Post ReplyReply Direct Link To This Post Topic: Custom control
    Posted: 25 Jul 2018 at 1:17pm
How can I register my own custom control?l
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7925
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 25 Jul 2018 at 6:01pm
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. 


Back to Top
Schoonhoven Gerrit View Drop Down
New Member
New Member
Avatar

Joined: 24 Sep 2017
Posts: 6
Post Options Post Options   Quote Schoonhoven Gerrit Quote  Post ReplyReply Direct Link To This Post Posted: 25 Jul 2018 at 6:52pm
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
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7925
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jul 2018 at 6:43pm
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.
Back to Top
Schoonhoven Gerrit View Drop Down
New Member
New Member
Avatar

Joined: 24 Sep 2017
Posts: 6
Post Options Post Options   Quote Schoonhoven Gerrit Quote  Post ReplyReply Direct Link To This Post Posted: 27 Aug 2018 at 4:55pm
What is a stub?
And again: please send me an example-file of a custom visual component.
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7925
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 27 Aug 2018 at 7:15pm
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:
Back to Top
Schoonhoven Gerrit View Drop Down
New Member
New Member
Avatar

Joined: 24 Sep 2017
Posts: 6
Post Options Post Options   Quote Schoonhoven Gerrit Quote  Post ReplyReply Direct Link To This Post Posted: 28 Aug 2018 at 12:14am
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?
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7925
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 28 Aug 2018 at 3:25pm
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.
Back to Top
Schoonhoven Gerrit View Drop Down
New Member
New Member
Avatar

Joined: 24 Sep 2017
Posts: 6
Post Options Post Options   Quote Schoonhoven Gerrit Quote  Post ReplyReply Direct Link To This Post Posted: 28 Aug 2018 at 11:30pm
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 ?
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7925
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 2018 at 2:09pm
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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down