The Grid Layout

Example

var btnSubmit = new TButton("Submit");
var layGrid = new TGridLayout(4, 2);
var txtAddress = new TTextBox();
var txtFirstName = new TTextBox();
var txtLastName = new TTextBox();
var txtPhone = new TTextBox();
var wndGridSample = createWindow('Grid Layout Sample');

layGrid.setCell(0, 0, new TText('First Name:'));
layGrid.setCell(1, 0, txtFirstName);
layGrid.setCell(2, 0, new TText('Last Name:'));
layGrid.setCell(3, 0, txtLastName);
layGrid.setCell(0, 1, new TText('Phone:'));
layGrid.setCell(1, 1, txtPhone);
layGrid.setCell(2, 1, new TText('Address:'));
layGrid.setCell(3, 1, txtAddress);

wndGridSample.add(layGrid);
wndGridSample.add(btnSubmit);
showModal(wndGridSample);

In this example, we created a simple register form using grid layout. Grid layout arranges components in cells using columns and rows.
Grid layout constructor takes several parameters:

var layGrid = new TGridLayout(columnsNumber, rowsNumber, margin, padding);

Grid Layout Methods
Method Description
alignLeft Positions all UI objects on the layout to the left. By default all objects have center align
alignRight Positions all UI objects on the layout to the right. By default all objects have center align
setCell Adds UI objects to the layout. Takes three parameters:
setCell(column, row, object)
setDirection Sets layout direction left to right (ltr) or right to left (rtl)