Choosing Your HTML Element
By default, TQTXWidget creates a <div> element. To create a different HTML element, you must override the CreateElementInstance function.
This is the key method that defines what your widget is.
- TQTXCustomButton overrides it to create a <button>
- TQTXCustomEdit overrides it to create an <input>
- TQTXDOMImage overrides it to create an <img>
Here is how you would override it to create a <pre> (preformatted text) element:
function TMyWidget.CreateElementInstance: TWidgetHandle;
begin
asm
@result = document.createElement("pre");
end;
end;