Reminder: To build a RAD pattern used to create a full project, the following files are required:

A form for RADFileA.

A form for RADFileB. A Vision Plus button (or a popup combo box) must allow you to select an element of RADFileA.

A form for RADFileC. A Vision Plus button (or a popup combo box) must allow you to select an element of RADFileB.

A table for RADFileA.

A table for RADFileB.

A table for RADFileC.

A relation window RADFileB/RADFileD.

These different elements must contain link buttons. You also have the ability to provide the main menu of the application.

Difference between Mobile and Smartphone

Creating an application for Mobile and an application for Smartphone are two different things. On a Smartphone, the screen is smaller and a drop-down menu allows you to validate (or not) the screens.

This difference also applies to the RAD patterns. This help page explains how to create a form window for Mobile and for Smartphone.

Standard to follow

This help page presents the different rules that must be applied when creating the pages and windows of the RAD pattern. These rules have been used to create the different patterns supplied with WINDEV Mobile 16.

These rules are recommendations. You can implement and use your own standard.

The relation windows in mobile

Overview

The relation windows are used to simultaneously display the information coming from several files. In a simple example, this type of window would be used to display the orders and the corresponding order lines. This type of window can be a Form + Table window.

A Form + Table window groups the elements of the forms and the elements of the tables.

This window contains a tab: this tab includes two panes: a pane displaying the form on RADFileB, a pane displaying the table on RADFileD.

The form includes the following elements:

A supercontrol: This supercontrol contains the controls of the form to display. This supercontrol is linked to the file to display.

A combo box and a Vision Plus button.

Buttons (if necessary) used to perform the main actions.

The table includes the following elements:

A table: This table is a browsing table, with file loaded in memory.

Buttons used to perform the main actions: Add, Modify, Delete and Print if necessary.

Link options used to display the corresponding forms for example.

A single relation window must be created in the RAD pattern: it links RADFileB to RADFileD.

Example: Relation window in the simple RAD pattern:

Creating a relation window for a Mobile pattern

To create a relation window for a Mobile pattern:

Select "File .. New .. Window", then "Blank window wizard". In the wizard, specify that the maximized window must include tabs.Click among the quick access buttons.

Click "Window" in the wheel that is displayed. The wizard for window creation starts. The window for creating a new element is displayed: click "Window" then "Window". The wizard for window creation starts.

Select "Wizard".

Specify that the maximized window must include tabs.

In the description window, enter the following information:

The window name. This name must necessarily contain the name of the file displayed in the form (some examples: WIN_Relation_RADFileD, WIN_Rel_RADFileD, ...).

The window title. If the title must display the file name, use the name of "RADFileXX" file (for example, "RADFileD": Relation").

Save the window.

The tab found in the window must display the following two elements:

a Form section: the characteristics of the form on RADFileB will be displayed in this section.

a Table section: the characteristics of the table on RADFileD will be displayed in this section. Buttons are used to manage the records found in the table.

Display the characteristics of the tab:

This tab is named "RADTab".

This tab includes two panes, a pane whose caption is "RADFileB form" and a pane whose caption is "RADFileD table" for example.

Creating the Form section:

Create a supercontrol in the tab containing the form ("Insert .. Special .. Supercontrol"). This supercontrol will display the controls found in the form. Position this control in the window and define its size. Scrollbars will be automatically displayed if some of the controls cannot fit in the specified size.Create a supercontrol in the tab containing the form: on the "Creation" pane, in the "Containers" group, click "Supercontrol". This supercontrol will display the controls found in the form. Position this control in the window and define its size. Scrollbars will be automatically displayed if some of the controls cannot fit in the specified size.

In the description window of the supercontrol, specify the name of the supercontrol. This name must be SC_RADFileB (SC_ is the prefix defined in the programming charter: it is not required if no programming charter is used).

In the "Content" tab of the description window of the supercontrol, specify:

the file browsed: RADFileB.

the item browsed: IDRADFileB.

Creating the Table section:

Create a Table control in the tab containing the table ("Insert .. Control .. Table").Create a Table control in the tab containing the table: on the "Creation" pane, in the "Data" control, expand "Table" and select "Table (Vertical)".

In the wizard for table creation, specify the following characteristics:

Select "Display the data found in a file or in an existing query".

Select the base file of the table: RADFileD.

Keep the proposed items. The search key is IDLinkedRADFileB.

Specify the source for the fill operation: "File loaded in memory".

Validate the name of the table.

Position the Table control in the window and define its size. The columns corresponding to the identifiers can be invisible if necessary.

Create and position the buttons used to manage the records displayed in the table. These buttons can have any name. We advise you to include:

a validation button (in the form section for example),

a deletion button (in the table section for example),

an insertion button (in the table section for example),

a menu option used to access the form of RADFileC.Caution: if the user is allowed to apply a skin template to the windows created by RAD, you must define the type of button that must be used in the skin template. This information can be defined in the modifier ("Skin template" category).

Case of the validation button (Validate button for example).This button is used to validate and close the window. To simplify things, you have the ability to use a preset action. We recommend that you use the "Close the window and return a value" action, with "Returned value: the value specified in the code by ..ReturnedValue".The code of this button is for example:

Case of deletion button (Delete button for example).This button can be used to delete a selected record from the table for example. The code of Delete button can be:

// Delete the current record TableDelete(TABLE_RADFileD)

In the code of the deletion button, we advise you to enable the automatic management of errors ("If Error: ", with the automatic process "Display the error and go back to edit").

Case of insertion button (Insert button for example).This button is used to insert a line above the current line for example. The code of the Insert button can be:

// Insert a row TableInsertLine(TABLE_RADFileD, -1)

In the code of the insertion button, we advise you to enable the automatic management of errors ("If Error: ", with the automatic process "Display the error and go back to edit").

Case of the "RADFileC form" menu option.Add (if necessary) a menu into your window ("Windows .. Main menu .. Add the main menu"). Add (if necessary) a menu into your window: on the "Window" pane, in the "Bars and menus" group, expand "Main menu" and select "Add the main menu".The name of this menu must be "MAINMENU_OPTIONS" and its caption must be "Options".In this menu, add an option used to display the form on RADFileC. The name of this option is "MENULIA_RADFileC" and its caption is "RADFileC form".This option is used to view in a form a record selected in the table. The code of this option can be:

// Find RADFileC for the current RADFileDHReadSeekFirst(RADFileC, IDRADFileC, RADFileD.IDRADFileCRel)// If RADFileC does not existIF HFound(RADFileC) = False THEN// Message indicating that there is no RADFileC record// linked to the current RADFileD recordInfo("No RADFileC record linked to the current record.") RETURNEND// Open the form window of RADFileCOpen(WIN_Form_RADFileC)

Initialization code of the window:

// Display the recordsFileToScreen()// Filter for the table of FileDHFilter(RADFileD, RADFileBRelID, RADFileB.RADFileBID)

Closing code of window. This code is used to disable the filter:

// Disables the filterHDeactivateFilter(RADFileD)

The relation windows in Smartphone

Overview

The relation windows are used to simultaneously display the information coming from several files. In a simple example, this type of window would be used to display the orders and the corresponding order lines. This type of window can be a Form + Table window.

A Form + Table window groups the elements of the forms and the elements of the tables.

This window contains a tab: this tab includes two panes: a pane displaying the form on RADFileB, a pane displaying the table on RADFileD.

The form contains a supercontrol: This supercontrol contains the controls of the form to display. This supercontrol is linked to the file to display.

The table is a browsing table, with direct access file.

The window also contains a menu for managing the table, the form and for accessing the RADFileC form.

A single relation window must be created in the RAD pattern: it links RADFileB to RADFileD. You must also create a form window used to view the records of the RADFileD file in form format.

Click "Window" in the wheel that is displayed. The wizard for window creation starts. The window for creating a new element is displayed: click "Window" then "Window". The wizard for window creation starts.

Select "Wizard". Keep the default options.

In the description window, enter the following information:

The window name. This name must necessarily contain the name of the file displayed in the form (some examples: WIN_Relation_RADFileD, WIN_Rel_RADFileD, ...).

The window title. If the title must display the file name, use the name of "RADFileXX" file (for example, "RADFileD": Relation").

Save the window.

Create a Tab control ("Insert .. Control .. Tab").Create a Tab control: on the "Creation" pane, in the "Containers" group, expand "Tab and associated" and click "Tab".

This tab must display the two following elements:

a Form section: the characteristics of the form on RADFileB will be displayed in this section.

a Table section: the characteristics of the table on RADFileD will be displayed in this section. Buttons are used to manage the records found in the table.

Display the characteristics of the tab:

This tab is named "RADTab".

This tab includes two panes, a pane whose caption is "RADFileB" and a pane whose caption is "RADFileD" for example.

Creating the Form section

Create a supercontrol in the tab containing the form ("Insert .. Special .. Supercontrol").This supercontrol will display the controls found in the form. Position this control in the window and define its size. Scrollbars will be automatically displayed if some of the controls cannot fit in the specified size.Create a supercontrol in the tab containing the form: on the "Creation" pane, in the "Containers" group, click "Supercontrol".This supercontrol will display the controls found in the form. Position this control in the window and define its size. Scrollbars will be automatically displayed if some of the controls cannot fit in the specified size.

In the description window of the supercontrol, specify the name of the supercontrol. This name must be SC_RADFileB (SC_ is the prefix defined in the programming charter: it is not required if no programming charter is used).

Display the characteristics of the supercontrol in the modifier. In the "Analysis" category, specify:

the file browsed: RADFileB.

the item browsed: IDRADFileB.

Creating the Table section

Create a Table control in the tab containing the table ("Insert .. Control .. Table").Create a Table control in the tab containing the table: on the "Creation" pane, in the "Data" group, expand "Table" and select "Table (Vertical)".

In the wizard for table creation, specify the following characteristics:

Select "Display the data found in a file or in an existing query".

Select the base file of the table: RADFileD.

Keep the proposed items. The search key is IDLinkedRADFileB.

Specify the source for the fill operation: "File with direct access".

Validate the name of the table.

Position the Table control in the window and define its size. The columns corresponding to the identifiers can be invisible if necessary.

Creating the menus and the menu options

Modify the menu found in the window:

menu options must allow you to add, modify or delete a row.

a menu option must allow you to access to the RADFileC file.

a menu option must allow you to delete the current record from the table.

a menu option must allow you to close the window.

Case of the "New row", "Modify row" and "Delete row" options.The "New row" option is used to enter a new record for the RADFileD file. The code of "New row" can be:

// Create a new recordHReset(RADFileD)// Open the form of RADFileD file in creation modeOpen(WIN_Form_RADFileD)// Refresh the tableTableDisplay(TABLE_RADFileD, taCurrentFirst)

The "Modify row" option is used to modify the selected row:

// Is a row selected?IF TableSelect(TABLE_RADFileD) = -1 THEN RETURN// Open the form of RADFileD file in modification modeOpen(WIN_Form_RADFileD)// Refresh the tableTableDisplay(TABLE_RADFileD, taCurrentSelection)

The "Delete row" option is used to delete the current row:

// Asks to confirm the deletionSWITCH YesNo("Do you want to delete the record?") CASE Yes// Delete the RADFileD record from the tableTableDelete(TABLE_RADFileD)// Position on the current recordTableDisplay(TABLE_RADFileD, taCurrentFirst) CASE No// No action END

Case of the option used to access RADFileCThis option is a link option. The code associated with this option is as follows:

// Find RADFileC for the current RADFileDHReadSeekFirst(RADFileC, IDRADFileC, RADFileD.IDRADFileCRel)

// If RADFileC does not existIF HFound(RADFileC) = False THEN // Message indicating that there is no RADFileC record // linked to the current RADFileD recordInfo("No RADFileC record linked to the current record.") RETURN END// Open the form window of RADFileCOpen(WIN_Form_RADFileC)

Click "Window" in the wheel that is displayed. The wizard for window creation starts. The window for creating a new element is displayed: click "Window" then "Window". The wizard for window creation starts.

Select "Wizard".

Keep the default options.

In the description window, enter the following information:

The window name. This name must necessarily contain the name of the file displayed in the form (some examples: WIN_Form_RADFileD, WIN_Frm_RADFileD, ...).

The window title. If the title must display the file name, use the name of "RADFileXX" file (for example, "RADFileD": Form").

Save the window.

Create a supercontrol in the window ("Insert .. Special .. Supercontrol"). This supercontrol will display the controls found in the form. Position this control in the window and define its size. Scrollbars will be automatically displayed if some of the controls cannot fit in the specified size. Create a supercontrol in the window: on the "Creation" pane, in the "Containers" group, click "Supercontrol".This supercontrol will display the controls found in the form. Position this control in the window and define its size. Scrollbars will be automatically displayed if some of the controls cannot fit in the specified size.

In the description window of the supercontrol, specify the name of the supercontrol. This name must necessarily be SC_Form (SC_ is the prefix defined in the programming charter: it is not required if no programming charter is used).

Display the characteristics of the supercontrol in the modifier. In the "Analysis" category, specify:

the file browsed: RADFileD.

the item browsed: IDRADFileD.

Modify the menu found in the window:

a menu option must allow you to validate the window.

// Read the information enteredScreenToFile()// If it's a new recordIF RADFileD..NewRecord = True THEN // Add it HAdd(RADFileD)ELSE // Modify it HModify(RADFileD)END// Return value of the windowMyWindow..ReturnedValue = True// Close the windowClose()

a menu option must allow you to close the window.

// Return value of the windowMyWindow..ReturnedValue = False// Close the windowClose()

Creating the combo boxes and a Vision button to enter the linked records:

Combo box on the RADFileB file

Vision button on RADFileB

Combo box on the RADFileC file

8.1. Combo box on RADFileBSelect "Insert .. Control .. Combo box".On the "Creation" pane, in the "Usual controls" group, click "Combo box". In the wizard for creating the combo box, select the following options:

"I want to enter a list of values or fill the combo box by programming".

the combo box is linked to the IDRADFileBRel relation key

the expanded control is a list.

the name of the control is "COMBO_IDRADFileB" (COMBO_ is the prefix defined in the programming charter: it is not required if no programming charter is used).

8.2. Vision button on RADFileBSelect "Insert .. Control .. Button".On the "Creation" pane, in the "Usual controls" group, click "Button". In the description window of the control, specify the name of the button. This control is named "BTN_VISION_RADFileB" (BTN_ is the prefix defined in the programming charter: it is not required if no programming charter is used).

The click code of the button is as follows:

// Open the vision window of RADFileBIF Open(WIN_Vision_RADFileB) = True THEN // Refreshes the content of the IDRADFileB combo box ListDisplay(COMBO_IDRADFileB, taCurrentFirst)END

8.3. Combo box on RADFileCSelect "Insert .. Control .. Combo box".On the "Creation" pane, in the "Usual controls" group, click "Combo box".In the wizard for creating the combo box, select the following options:

"I want to enter a list of values or fill the combo box by programming".

the combo box is linked to the IDRADFileCRel relation key

the expanded control is a list.

the name of the control is "COMBO_IDRADFileC" (COMBO_ is the prefix defined in the programming charter: it is not required if no programming charter is used).