In This Chapter
The basic user interface object in Servoy is a form. Forms are also a unit of scope in Servoy, meaning that forms can have variables and methods attributed to them. For more information about scope, see Implementing Business Logic .
Creating a Form
To create a form:
- Right click on the active solution in Solution Explorer, select Create New Form
- Right click on the Forms node under the solution (or module) you wish to create a form in the Solution Explorer and select Create New Form
- Click on the New Form button in the Servoy Developer toolbar
Any of these actions will open the New Form Wizard that will walk you through creating a form.
New Form Wizard
To walk through the options available in the New Form Wizard, these instructions will use the example_data connection and the customers table.
- Before entering a name for the form, select the table desired. Clicking on the ... button will open a tree view to select the table from all the existing database connections. If you do not want to base the form on a table, select -none-. In our example, select example_data.customers.
Notice that the name of the table will appear in the name field. You may edit this name; keep in mind that no two forms can have the same name in the solution. For our example, name this form 'customers_dtl'.
Naming conventions can help you keep track of forms and tell what the form purpose is just by its name.
- If you are using a style sheet, you can select the name of the style you want use.
- Verify the solution named is the correct solution for the form.
- Click Next.
- Select data providers to appear on the form. Note that you can select columns, calculations, form variables, global variables, and data providers by relation. Holding the shift key will select a range; holding the control key will allow for multiselect. For this example, select a few columns from the table.
There are options on how the data providers will be added to the form. For the most part, for a regular record view form, you only need the Place with Labels option checked. For this example, just select Place with Labels
Forms normally are created in record view, but if you select Fill text property and Place horizontal, the form will be set in table view.
- Click Finish.
- The newly created form is now loaded in Form Designer.
Editing a Form
To edit a pre-existing form in Form Designer:
- Select the form in Solution Explorer.
- Do one of the following
- Press Ctrl-Shift-a
- Right click on the form name (or any child node of the form in the tree) and select Open in Form Designer.
- Right click on the form name in the Solution Explorer list view and select Open in Form Designer.
- The form should appear in the Form Designer editor view in the center of the Workbench.
To edit a form in Script Editor:
- Select the form in Solution Explorer
- Do one of the following
- Press Ctrl-Shift-z
- Right click on the form name (or any child node of the form in the tree) and select Open in Script Editor.
- Create a new form method. See Implementing Business Logic for more details.
- The form should appear in the Script Editor view in the center of the Workbench.
Right clicking in either editor view will display a menu that has the option to open the form in the other editor view. Example: if you have a form open in Form Designer, you can right click and select Open in Script Editor.
Saving a Form
Saving a form is the same as saving any other editor view in Servoy Developer, see Intro to Servoy Developer
Quick Start Video