![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
![]() |
Mon, Mar 6 2017 5:16 AM | Permanent Link |
Michael Dreher | In a component I have a class variable with an inline initialization.
type TftHtmlEdit = class(TBasicPanelControl) private FBrowser : TBrowser; class FNextBrowserFrameNumber : integer = 1; public constructor Create(aOwner : TComponent); override; end; In the constructor... constructor TftHtmlEdit.Create(aOwner : TComponent); begin inherited Create(aOwner); FBrowser := TBrowser.Create(Self); FBrowser.ClientID := BROWSER_DIV_ID_PREFIX + IntToStr(FNextBrowserFrameNumber); <<---internal IDE error here // ... end; When loading a form in the IDE with this component I get an "internal error (value conversion error)". All fine at runtime. It seems the class variable ist not initialized at design time when the constructor is called. Of course conditional compiling helps {$IFNDEF DESIGN} FBrowser.ClientID := BROWSER_DIV_ID_PREFIX + IntToStr(FNextBrowserFrameNumber); {$ENDIF} Is this the wrong approch initializing a class variable? Version 2.05B4, and 2.06B1. A cut down example is attached. Thanks! Michael Dreher Attachments: CodeExample.zip |
Mon, Mar 6 2017 5:31 AM | Permanent Link |
Matthew Jones | Michael Dreher wrote:
> class FNextBrowserFrameNumber : integer = 1; Presumably a mix-up between the default values and the class values. Could you set the default in a unit intialisation instead? Or is that a different issue? -- Matthew Jones |
Mon, Mar 6 2017 5:51 AM | Permanent Link |
Michael Dreher | "Matthew Jones" wrote:
// Could you set the default in a unit intialisation instead? I tried initialization TftHtmlEdit.FNextBrowserFrameNumber := 12345; no differences. M. Dreher |
Tue, Mar 7 2017 1:36 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Michael,
<< In a component I have a class variable with an inline initialization. >> This is now fixed in the latest 2.06 B3 beta that I just uploaded (yes, I'm incrementing the build numbers for betas now). Thanks, Tim Young Elevate Software www.elevatesoft.com |
Mon, Mar 27 2017 11:29 AM | Permanent Link |
Michael Dreher | Tim Young [Elevate Software] wrote:
// This is now fixed in the latest 2.06 B3 beta that I just uploaded A late response, sorry. Initialization of class variables in the class decl now works fine. The same error occures on initialization in the "initialization"-section when the library is build. Eample: type TTestComponent = class(TControl) private protected class FClassVar : integer = 12; // Works fine now. public published end; implementation initialization TTestComponent.FClassVar := 42; // [Error] TestComponent001.wbs (20,4): Internal error (Access violation at // address 00000000 in module 'ewbide.exe'. Read of address 00000000) Michael Dreher |
Mon, Mar 27 2017 12:53 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Michael,
<< A late response, sorry. Initialization of class variables in the class decl now works fine. The same error occures on initialization in the "initialization"-section when the library is build. Eample: >> Thanks, I'll check it out. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Sunday, April 27, 2025 at 01:25 AM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |