The Window Object

Window object is the main container for all GUI components in the library along with the Page object. You may add and arrange components on it to form your user interface.

Create Window Container
var wndTest = createWindow("Test");
wndTest.add(new TText("Hello World!"));
showModal(wndTest);

In this example, we created a window container with 'Test' title and added a text component to it.

Use showModal method to show the window.

Close Window Container
var onCloseClick = function() {
hideModal();
};

var wndTest = createWindow("Test", 20, 20);
var btnClose = new TButton("Close");
btnClose.setOnClick(onCloseClick);
wndTest.add(new TText("Hello World!"));
wndTest.add(btnClose);
showModal(wndTest);

In this example, we added a close button to close and hide the window container. The hideModal method will close the latest opened window container.

In addition to the title parameter of the createWindow method, there are severl optional parameters:

createWindow(title, margin, padding, layout, underText);

By default window container takes vertical layout. You may set a horizontal layout instead by passing a layout object to the method.

Window Container Methods
Method Description
Add Adds an object to window
Refresh Resize window object with its contents based on view port dimensions
setTitle sets window title