Choose your database:
MS SQL Server
SQL Anywhere

Subscribe to our news:
Kirby Foster: "Nice software. Small, lightweight, works well. I evaluated lots of software before deciding that your software worked the best for what I do. Both Maestro for MySQL and PHP Generator have saved me lots of time".
Jonathan Oakes: "This is a lovely application. It's easy to hook into my own bespoke applications. It's very powerful, yet really quite simple to use. Thanks for this".


Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next


This event allows you to customize the layout for View, Edit, and Insert forms. Live Demo. Video Tutorial.



function OnGetCustomFormLayout($mode, FixedKeysArray $columns,

                               FormLayout $layout)      




The form mode. Possible values are "edit", "inline_edit", "insert", "inline_insert", and "view".


The associative array of columns displayed in the form.


An instance of the FormLayout class.



Layout structure

The layout has the following hierarchical structure: layout -> groups -> rows -> columns. This means you can add groups to the layout, rows to groups, and columns to rows.


Layout mode

By default all forms are horizontal i.e. the control label is placed on the left of the editor (for vertical forms the label is placed on the top of the editor). To create a vertical form, use the following call:




Adding a group

To add a new group to the layout, use the addGroup method of the FormLayout class:


function addGroup($name = null, $width = 12);


This function returns an instance of the FormLayoutGroup class that can be later used to add rows to the new group (see below). Width is provided in relative units, possible values are integers from 1 to 12.


Adding rows to a group

To add a new row to a group, use the addRow method of the FormLayoutGroup class (see above):


function addRow();


This function has no parameters and returns an instance of the FormLayoutRow class that can be later used to add controls to the new row (see below).


Adding controls to a row

To add a new control to a row, use the addCol method of the FormLayoutRow class (see above):


function addCol($column, $inputWidth = null, $labelWidth = null);


This function also returns an instance of the FormLayoutRow class to allow method chaining. Here $column is an element of the $columns array and $inputWidth and $labelWidth are relative widths of the editor and its label accordingly ($labelWidth can be used only for horizontal forms).



All the examples below can be seen live in our Feature Demo.


Example 1

This example shows how to create a simple group with 2 rows and 2 controls in each row (all controls have equal width):


$displayGroup = $layout->addGroup('Display');


    ->addCol($columns['display_type'], 6)

    ->addCol($columns['display_size'], 6);


    ->addCol($columns['display_resolution_x'], 6)

    ->addCol($columns['display_resolution_y'], 6);


Example 2

This example shows how to create a group and place 3 editors in the same row:


$storageGroup = $layout->addGroup('Storage', 12);


    ->addCol($columns['storage_min'], 4)

    ->addCol($columns['storage_max'], 4)

    ->addCol($columns['storage_external'], 4);


Example 3

This example shows how it is possible to place 2 groups in a row:


$hardwareGroup = $layout->addGroup('Hardware', 6);

$hardwareGroup->addRow()->addCol($columns['chipset'], 12);

$hardwareGroup->addRow()->addCol($columns['cpu'], 12);

$hardwareGroup->addRow()->addCol($columns['gpu'], 12);


$softwareGroup = $layout->addGroup('Software', 6);

$softwareGroup->addRow()->addCol($columns['os_basic'], 12);

$softwareGroup->addRow()->addCol($columns['os_upgradable'], 12);

$softwareGroup->addRow()->addCol($columns['web_browser'], 12);

Prev Return to chapter overview Next