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

Deriving components

 Post Reply Post Reply
Author
Mark Fairlamb View Drop Down
New Member
New Member
Avatar

Joined: 13 Aug 2019
Posts: 6
Post Options Post Options   Quote Mark Fairlamb Quote  Post ReplyReply Direct Link To This Post Topic: Deriving components
    Posted: 10 Oct 2019 at 6:47am
I am trying to derive components from WEBcore component... When I ran into trouble I tried the following very simple test.
1.) I made a unit BtnTest as follows:
{------------------------------------------}
unit BtnTest;

interface

uses WEBLib.StdCtrls;

Type
  TChildButton = class(TWebButton)
  end;

procedure Register;

implementation

uses Classes;

procedure Register;
begin
  RegisterComponents('WebComps', [TChildButton]);
end;
{------------------------------------------}

2.) Created a package TestBtn as follows:
{------------------------------------------}
package TestBtn;

{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO OFF}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DEFINE DEBUG}
{$ENDIF IMPLICITBUILDING}
{$IMPLICITBUILD ON}

requires
  rtl;

contains
  BtnTest in 'BtnTest.pas';

end.
{------------------------------------------}


When I compile I get  a compile error:
Invalid compiler directive 'modeswitch'
in the unit WEBLib.Graphics.

My questions:
1.) Is it possible to create components based on the WEB core components?
2.) If so what am I doing incorrectly?
3.) Is there a special trick to get the components to show on the component palette when a WEBCore form is active in the IDE?
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8411
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 10 Oct 2019 at 10:33am
I assume you compile this package from the Delphi IDE as package to install the design-time version of the component? (i.e. it gets compiled with the DCC32 compiler)

It should be possible to add such component (stub) for the design-time via a package to the IDE tool palette.
Then make sure to add the runtime class source file to a folder in the library path of the pas2js compiler.



Back to Top
Mark Fairlamb View Drop Down
New Member
New Member
Avatar

Joined: 13 Aug 2019
Posts: 6
Post Options Post Options   Quote Mark Fairlamb Quote  Post ReplyReply Direct Link To This Post Posted: 11 Oct 2019 at 5:55am
Thanks for the reply Bruno.
Yes I am compiling from the Delphi 10.3 IDE.
I have added my source folder to the pas2js compiler library path in Tools| Options | TMS Web | Options | Library path.

I resolved my compilation error by changing my search path from "..\Core Source" to "...\Component Library Source" so I can now compile and install my test component.  

The new component is visible on the component palette for VCL applications but disappears when a WEBCore form is active.  How can I make it available for designing WEBCore applications?

Back to Top
Mark Fairlamb View Drop Down
New Member
New Member
Avatar

Joined: 13 Aug 2019
Posts: 6
Post Options Post Options   Quote Mark Fairlamb Quote  Post ReplyReply Direct Link To This Post Posted: 11 Oct 2019 at 7:55am
I tried amending my type definition to:
Type
  [ComponentPlatforms(TMSWebPlatform)]
  TChildButton = class(TWebButton)
  end;
 but it is still not visible for WebCore forms
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8411
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 11 Oct 2019 at 8:33am
You need to recompile the package after adding the attribute and possibly you need to close the IDE, remove the package from the cached packages (registry) and restart the IDE and recompile the package. The IDE is known to often keep working with cached component info.
Back to Top
Mark Fairlamb View Drop Down
New Member
New Member
Avatar

Joined: 13 Aug 2019
Posts: 6
Post Options Post Options   Quote Mark Fairlamb Quote  Post ReplyReply Direct Link To This Post Posted: 14 Oct 2019 at 3:48am
Thanks Bruno - but sadly still no component visible for WebCore. I did all you said, and even made a new package with a new component but still no luck.  Although I can use new component in a WebCore application by adding a web button and then changing the type manually.
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8411
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 14 Oct 2019 at 10:03pm
Other than the package cache, I cannot think of a reason (we have encountered the package cache here in the past)
Did you uninstall the package, close the IDE, then remove your package from the registry
HKEY_CURRENT_USER\Software\Embarcadero\BDS\XX.0\Package Cache  and then restart the IDE and compile + install the package?
Back to Top
Mark Fairlamb View Drop Down
New Member
New Member
Avatar

Joined: 13 Aug 2019
Posts: 6
Post Options Post Options   Quote Mark Fairlamb Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 2019 at 1:08am
I did.  I also made a new package with a different name and component and installed it without success.  I tried installing the new component into Delphi 10.2 with the same results as in Delphi 10.3.
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8411
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 2019 at 9:05am
I am out of ideas.
Please send code/package so we can inspect here;
Back to Top
Mark Fairlamb View Drop Down
New Member
New Member
Avatar

Joined: 13 Aug 2019
Posts: 6
Post Options Post Options   Quote Mark Fairlamb Quote  Post ReplyReply Direct Link To This Post Posted: 16 Oct 2019 at 4:09am
Thanks Bruno - I have sent a zip of the code and package
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8411
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 16 Oct 2019 at 9:52am
we will have a look and reply to the email.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down