Create TChromium instance with code
-
27-10-2019 - |
Question
I have an issue trying to create Delphi Chromium Embedded instance with code
var
Chromium: TChromium;
begin
Chromium := TChromium.Create(TcxTabSheet1);
Chromium.Parent := TWinControl(TcxTabSheet1);
Chromium.Align := alClient;
Assert(Assigned(Chromium.Browser), 'HERE! Why Browser is not assigned.');
...
end;
Seems like Browser property is initialized when
procedure TCustomChromium.CreateWindowHandle(const Params: TCreateParams);
is called.
Why CreateWindowHandle is not called in my code?
Solution
My comment as an answer:
The reason Chromium.Browser
is not yet assigned, when the Browser property is initialized from the CreateWindowHandle, is:
Because nothing has been done yet that calls HandleNeeded (which will call CreateWindowHandle when none has been assigned yet)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow