This constructor is for absorbing an existing HTML element. You pass it a THandle (a reference to an existing DOM element).


  • The widget sets its ownership model to wmManaged.
  • It "absorbs" the Handle and manages it.
  • When the widget is released, it will not destroy the DOM element, since it doesn't own it.


This allows you to load a complex HTML template and then "activate" it by creating TQTXWidget-based objects and attaching them to the elements. You can also inject a HTML string into another widget, the browser quickly creates the elements -and you can enumerate the child elements and create pascal classes for them.


So you can actually do this:


Panel1.InnerHtml :="<div>hello!</div><div>this is awesome</div>";


And the browser will create two child elements very quickly. Some times its actually faster to do things this way than to meticulously define a pascal class hierarchy. The browser is so optimized for parsing HTML and creating elements, so its blistering fast. Just be aware that if you have widgets already on Panel1, the elements they manage will no longer be valid. So make sure you use this prudently or there will be problems.