- The steps for creating a RAD pattern
- Creating the different pattern windows
- The files to create
- Standard to follow
- The relation windows
- Creating a relation window
Creating the Relation windows of a WINDEV RAD pattern
The steps for creating a RAD pattern
Creating the different pattern windows
The files to create
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.
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 27.
These rules are recommendations. You can implement and use your own standard.
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.
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 buttons used to display the corresponding forms for example.
In the RAD pattern, a relation window must be created: it links RADFileB to RADFileD.
: Relation window in the simple RAD pattern:
Creating a relation window
To create a relation window:
- Click in the quick access buttons:
- The creation window appears: click "Window" then "Window".
- The window creation wizard starts.
- In the wizard, select "Blank" and validate.
- 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 window must be divided in two sections:
- 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.
Creating the Form section:
- Create a supercontrol in the window: on the "Creation" tab, 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 supercontrol description window, specify the name of the supercontrol. This name must necessarily be SC_Form (SC_ is the prefix defined in the code style: it is not required if no code style is used).
- In the "Content" tab of the supercontrol description window, specify:
- the file browsed: RADFileB.
- the item browsed: IDRADFileB.
Creating the Table section:
- Create a Table control in the window: on the "Creation" tab, in the "Data" group, expand "Table and List Box" and select "Table (Vertical)".
- In the table creation wizard, 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 delete button,
- a button used to access the form of RADFileC,
- a button for validating the window,
- a cancel button.
- link buttons.
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 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
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 button to RADFileC (link button BTN_FormLink_RADFileC for example).
This button can be used to view in a form a record selected in the table for example.
The button code can be:
// Find RADFileC for the current RADFileD
HReadSeekFirst(RADFileC, IDRADFileC, RADFileD.IDRADFileCRel)
// If RADFileC does not exist
IF HFound(RADFileC) = False THEN
// Message indicating that there is no RADFileC record
// linked to the current RADFileD record
Info("No RADFileC record linked to the current record.")
// Open the form window of RADFileC
Remark: default link buttons are also required. For more details, see Creating the link buttons.
- Case of closing 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:
// Check controls
IF TABLE_RADFileD..Count = 0 THEN
Error("RADFileD must be typed")
// Update the HyperFileSQL context
// Add or modify RADFileB
IF RADFileB..NewRecord = True THEN
// RADFileB was added
// Add the corresponding RADFileD
FOR EACH ROW OF TABLE_RADFileD
// Assign the identifier of RADFileB
// to the columns of the table of RADFileD
TABLE_RADFileD.COL_IDRADFileBRel = RADFileB.IDRADFileB
// Save the table
// Return value
MyWindow..ReturnedValue = True
- Case of cancelation button:
This button is used to cancel 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 can be for example:
// If a creation is in progress, ask for confirmation
IF RADFileB..NewRecord THEN
//2: &Don't save
SWITCH Dialog("A record is currently created.")
// Runs the click code of the validate button:
// save the current data
//2: &Don't save
CASE 2 // The window will be closed without backup
CASE 3: RETURN
- Initialization code of the window:
// Display the records
// Filter for the table of FileD
HFilter(RADFileD, RADFileBRelID, RADFileB.RADFileBID)
// Default return value
MyWindow..ReturnedValue = False
- Closing code of window. This code is used to disable the filter:
// Disables the filter
This page is also available for…