Deriving components |
Post Reply ![]() |
Author | |
Mark Fairlamb ![]() New Member ![]() Joined: 13 Aug 2019 Posts: 6 |
![]() ![]() ![]() ![]() 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?
|
|
![]() |
|
Bruno Fierens ![]() TMS Support ![]() Joined: 11 May 2010 Posts: 8326 |
![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
Mark Fairlamb ![]() New Member ![]() Joined: 13 Aug 2019 Posts: 6 |
![]() ![]() ![]() ![]() |
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? |
|
![]() |
|
Mark Fairlamb ![]() New Member ![]() Joined: 13 Aug 2019 Posts: 6 |
![]() ![]() ![]() ![]() |
I tried amending my type definition to:
Type [ComponentPlatforms(TMSWebPlatform)] TChildButton = class(TWebButton) end; but it is still not visible for WebCore forms
|
|
![]() |
|
Bruno Fierens ![]() TMS Support ![]() Joined: 11 May 2010 Posts: 8326 |
![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Mark Fairlamb ![]() New Member ![]() Joined: 13 Aug 2019 Posts: 6 |
![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Bruno Fierens ![]() TMS Support ![]() Joined: 11 May 2010 Posts: 8326 |
![]() ![]() ![]() ![]() |
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?
|
|
![]() |
|
Mark Fairlamb ![]() New Member ![]() Joined: 13 Aug 2019 Posts: 6 |
![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Bruno Fierens ![]() TMS Support ![]() Joined: 11 May 2010 Posts: 8326 |
![]() ![]() ![]() ![]() |
I am out of ideas.
Please send code/package so we can inspect here; |
|
![]() |
|
Mark Fairlamb ![]() New Member ![]() Joined: 13 Aug 2019 Posts: 6 |
![]() ![]() ![]() ![]() |
Thanks Bruno - I have sent a zip of the code and package
|
|
![]() |
|
Bruno Fierens ![]() TMS Support ![]() Joined: 11 May 2010 Posts: 8326 |
![]() ![]() ![]() ![]() |
we will have a look and reply to the email.
|
|
![]() |
Post Reply ![]() |
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |