[Pas2js] How to change a div (or othe widget) content

Luca Olivetti luca at ventoso.org
Tue Oct 4 09:30:53 CEST 2022


El 3/10/22 a les 17:35, Michael Van Canneyt via Pas2js ha escrit:

> 
> I have changed this.
> 
> I have also added TextMode as a property so you can choose between 
> InnerText
> and InnerHTML


Unfortunately you left out the "if FTextContent<>''" which broke my page 
(it empties a div hence later it doesn't find the element that were there).
This fixes it for me

--- a/packages/webwidget/htmlwidgets.pp
+++ b/packages/webwidget/htmlwidgets.pp
@@ -3195,10 +3195,11 @@ end;
  procedure TCustomTagWidget.ApplyWidgetSettings(aElement: TJSHTMLElement);
  begin
    inherited ApplyWidgetSettings(aElement);
-  if TextMode=tmText then
-    aElement.InnerText:=TextContent
-  else
-    aElement.InnerHTML:=TextContent
+  if FTextContent<>'' then
+    if TextMode=tmText then
+      aElement.InnerText:=TextContent
+    else
+      aElement.InnerHTML:=TextContent
  end;



Bye


More information about the Pas2js mailing list