add
[ Function ]
public static add(
control: TcHmi.Controls.System.baseTcHmiControl,
element: JQuery | undefined | null,
options?: TopMostLayer.IOptions
): boolean;
Inserts an HTML element into the overlay area above the normal visualization. This function is intended for use from a control. If this is removed (detached) from the DOM, all elements are also removed from the TopMostLayer.
A reference to the element should be saved in the control to call the remove() function.
Parameter
Name | Type | Description |
---|---|---|
control | Calling control. | |
element | JQuery collection with an HTML element. | |
options [optional] | Options for extended functionalities. |
Return value
Type | Description |
---|---|
Result as to whether the call was successful |
Available from version 1.10 |
Sample - JavaScript
var myPopup = $('<div style="background:white;padding:10px;">Hello World<div>');
TcHmi.TopMostLayer.add(this, myPopup, {
centerHorizontal: true,
centerVertical: true,
removeCb: (data) => {
if (data.canceled) {
// user clicked on background
}
}
});