* Fix demo to work again with latest webwidgets

This commit is contained in:
michael 2021-04-01 08:29:56 +00:00
parent 78cff9a0ec
commit efea6321bd
3 changed files with 18 additions and 15 deletions

View File

@ -28,12 +28,11 @@
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<RequiredPackages>
<Item>
<PackageName Value="lazwebwidgets"/>
</Item1>
</Item>
</RequiredPackages>
<Units>
<Unit>
@ -88,16 +87,16 @@
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Exceptions>
<Item>
<Name Value="EAbort"/>
</Item1>
<Item2>
</Item>
<Item>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
</Item>
<Item>
<Name Value="EFOpenError"/>
</Item3>
</Item>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -1,7 +1,7 @@
program designdemo;
{$mode objfpc}
{$DEFINE USEIDE}
{ $DEFINE USEIDE}
uses
browserapp, JS, Classes, SysUtils, Web, designer, webideclient;

View File

@ -70,7 +70,7 @@ Type
{ TJumboWidget }
TJumboWidget = class(TCustomTemplateWidget)
TJumboWidget = class(TSimpleTemplateWidget)
Public
Constructor Create(aOwner: TComponent); override;
end;
@ -91,7 +91,7 @@ type
constructor TJumboWidget.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
Template.Text:='<div class="jumbotron">'+sLineBreak+
Template:='<div class="jumbotron">'+sLineBreak+
'<h1 class="display-4">Hello, world!</h1>'+sLineBreak+
'<p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>'+sLineBreak+
'<hr class="my-4">'+sLineBreak+
@ -145,6 +145,7 @@ begin
S.Free;
end;
end;
function TDesignDemo.DoActive(Event: TEventListenerEvent): boolean;
Const
@ -164,7 +165,10 @@ begin
JQuery('.designerToolbar').remove();
aNewActive:=TJSHTMLElement(event.target);
aParent:=FPage.FindWidgetByID(String(aNewActive.dataset[STopElementData]));
if (FAddWidget<>Nil) and (aParent<>Nil) then
if aParent=Nil then
aParent:=FPage;
if (FAddWidget<>Nil) then
begin
aNewWidget:=FAddWidget;
FAddWidget:=Nil;