Design the Form

See also: Data Control Wizard


Form Design Window

You can select items to be placed on the form from the appropriate Widget and Container menus, or from the toolbar icons. All widgets must be within a container, usually a Grid, ScrollGrid, Table, or Folder. The Data Control container, or the File>>New, Genero, Form from Database menu option, allows you generate a form by specifying the database columns that will make up the form fields.

Note: File>>New, Design, CRUD Form from Database allows you to create a CRUD Form (Create, Read, Update, Delete) that will be part of an Application Generator application.

Form tab

This tab displays the form items that you selected in the main window:

   

 To position a form item on the container:

Widgets can be:

You can specify the appearance or behavior of a form item by setting or modifying the values for its properties in the Properties view. 

Records tab

This tab displays the screen record for the form, consisting of all the database field names that make up the fields on the form itself. 

The structure of the screen record, as well as the structure for the form itself, is displayed in the Central Work area.  Properties for the screen record and its items are primarily used in an Application Generator application, see Your First Application


Handling Errors

Form Designer detects errors in the form design, and displays an error message in the Errors tab in the Output view.

Undo / Redo on the Edit menu and the toolbar allow you to reverse all actions taken since the form was opened.


Align/Layout

Parent containers will automatically enlarge when there is not enough space for a child container. The parent container size is limited to the form's maximum width and height.

To align items on the form, use the toolbar icons or the Alignment menu. Only widgets inside the same container may be aligned.

Advanced Alignment dialogs

Layout

If a parent container has more than one child container, the child containers must be grouped and aligned using layouts. Use the toolbar icons or the Layout menu to group them:

The form must be large enough to contain both the child containers in their desired position, as well as the layout container. 

First, move the child containers into the desired position on the form. Then select Horizontal or Vertical layout, and draw the layout so that it contains the child containers.


Tab Index

The order of the form items for data entry (when using the Tab key to move from field to field) may be specified using the  Widget>>Tab Index menu option or clicking the Tabindex icon. All items that allow entries are displayed in the Form Design window with an index number specifying the order:

    

 To alter the order:

  1. Double-click a number to change it to 1
  2. Click any number to change it to the next number after the last used. And so on.
  3. To finish the current sequence, Click ESC.
  4. Click ESC again to exit tab order.

Form Structure View

The structure of the form is displayed in the Form Structure view. As you add form items to the Form Design window, the elements are automatically added to a tree structure in the Form Structure tabbed page. Expand the nodes in the tree to display or hide the different form items. For example:

Selecting a form item also selects the corresponding object in the Form Design window, and displays the item's properties in the Properties view.

Right-click on the Form item in the Structure view to display a menu allowing you to add Topmenus, ActionDefault Lists, or Toolbars to the form. You can also apply Styles to the form objects - see Using Styles.

Change a Container for a Widget (Convert Container)

Right-click the container object in the Form Design Design window, or the container element in the Structure view, to select the menu option Convert Container. A dialog window allows you to select the new container.


Properties View

Selecting one item from the design window makes this item current, and its properties are displayed in the Properties view and available for updating. Each form item, as well as the form itself, has its own specific properties that can be set.

    

Multiple properties can be selected using Ctrl-click.  If multiple properties have been selected, only the common properties will display in the Properties view.


Build (Compile) the Form

Compiling your form definition translates it into an XML file with an extension of  .42f. This XML file is used by the Genero client to display the application form on the user's desktop. Compiling a form can be specifically requested from the Build menu, or it can be executed from Project Manager as part of a Build of an entire application. A form can also be compiled  from the command line using gsform.

You can  use the Build menu or toolbar icons to:

All . 42f files must be included with your application code in distributions.

Command-line syntax: gsform

The Genero Studio form definition file (.4fd) can also be compiled from the operating system command line, using the tool gsform, which is located in the <GeneroStudio-install-dir>/bin directory. The gsform tool executable file should not be moved to another directory.

Use gsform if you want to:

Syntax:

gsform [options] file1[.4fd] file2[.4fd] ...

where filen is a Genero Studio form file with or without the extension being specified.

Option  Description
 -h Display help instead of the standard behavior
 -m Extract localized messages, See BDL documentation Localized Strings for additional information.
 -V Version information
 -c Convert old format .4fd files to new format. Old format <filename>.4fd files are backed up in <filename>.bak, New format files are saved in <filename>.4fd. If the backup fails, the conversion is aborted.
 -import Import .per file as Studio .4fd file
 -keep Keep intermediate .per file that is created; do not delete.
The compilation process uses temporary .per files. In case there are unexpected (internal) errors, this option avoids the temporary files deletion so that the file can be read.
Note that Form Designer and gsform don't allow compilation when .per files with the same filename as .4fd files are present in the same directory.
 -dbname database Provide the database name database to use for form compilation. If the 4fd files use a database, it Is strongly recommended that you provide the database name using this option to reduce computation time.
 -i Ignore existing .per file; overwrites it.
 -M Display all compilation messages. See BDL documentation Compiling Programs for additional information.
 -W   Display warning messages. Option all turns on all messages.

Using Styles

Genero Presentation Styles files define a set of properties that can be used to centralize the appearance of forms and form items.

Style file property

You can use any existing Genero Presentation Styles file for your form. Select the form object in the Form Structure view to display the form's properties:

    

 

Select the style file property, and click the ... button to browse on your system for the Presentation Styles file that you want to use for your form.

If no Genero style file is specified in the Style file property, and a default.4st file is found in the path specified by the FGLRESOURCEPATH environment variable, the default.4st file is used for form previews and style dialogs. if no default.4st  file is found in FGLRESOURCEPATH, the default.4st file from <FGLDIR>/lib is used.

This provides flexibility in the use of style files. You can:

Style property

Once a Style File property has been set for the form, the style property s enabled for form items. Select a form item to display its properties.  Select the style property, and click the ... button to display the Style Dialog, allowing you to select a style for the selected form item.

Style Dialog

A tree of the available styles from the form's Style File is displayed:

   

Click the checkbox to select individual styles, or select/de-select all using the file name. 

If the same attribute is defined in several styles that you have selected, you can use the Up/Down arrow buttons to change the priority order of the styles. 


Using Localized Strings

Localized Strings allow you to customize the text displayed by your application, for internationalization or site-specific text.. The localizedStr property allows you to set localization for an individual widget or form item, where applicable. Setting the checkbox for localized strings to "True" will mark the related strings for localization. 

Once the form definition is completed, you can use the gsform utility from the command line to generate a text file of the localized strings.  For example:

   gsform -m myform.4fd > myfile.str

The format of the file will be "string key" = "string text".  You can copy the file and change the string text as needed for localization.  Do not change the string key, as this is generated by Studio.  See Localized Strings for additional information.

The localized strings file must be added to a library for your project in Project Manager, and the library linked to your application node. When the application is Built, the localized string will be compiled and linked into your application.