Creating Web Component instances

To create a Web Component instance, we added a specific method that will allow you to embed the component in the web page, tied or untied to a Windows control.

When the Web Component is tied to a Windows control, it will look like it is "embedded" in the form, replacing the Windows control area, following its position and size when it changes. When untied, it will be embedded into the web page, but its position and size will not be attached to any control area.

VirtualUI.HTMLDoc.CreateComponent(Id, TagOrHTML, ReplaceWnd)

· "Id" parameter is the HTML element ID.

· "TagOrHTML" can be a tagname or a valid HTML string.

· "ReplaceWnd" is the handle to the window control to be "replaced".

Examples:

1. Adding a tied Web Component by the tagname:

VirtualUI.HTMLDoc.CreateComponent("video1", "vui-video", panel1.Handle)

In this example, the HTML "<vui-video></vui-video>" will be inserted, and dynamically positioned according to panel1's position and size.

2. Adding tied HTML content from a valid HTML string:

VirtualUI.HTMLDoc.CreateComponent("hworld", "<div><span>hello world</span></div>", panel1.Handle)

In this example, the HTML "<div><span>hello world</span></div>" will be inserted, and dynamically positioned according to panel1's position and size.

3. Adding an untied Web Component by the tagname:

VirtualUI.HTMLDoc.CreateComponent("qzprinter1", "qzprinter")

In this example, the Web Component will be inserted, but not positioned according to any visible control.

Last updated