PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • The steps for creating a RAD pattern
  • Creating the different pattern windows
  • The files to create
  • Standard to follow
  • The relation windows
  • Overview
  • Creating a relation window
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Creating the Relation windows of a WINDEV RAD pattern
The steps for creating a RAD pattern
The steps for creating a WINDEV RAD pattern are as follows:
  1. Creating the "RAD Pattern" project.
  2. Creating the different pattern windows.
  3. Generating the RAD pattern.
  4. Using the 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 23.
These rules are recommendations. You can implement and use your own standard.
The relation windows

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.
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.
Example: Relation window in the simple RAD pattern:

Creating a relation window

To create a relation window:
  1. Select "File .. New .. Window", then "Blank".Click among the quick access buttons:
    • Click "Window" in the wheel that is displayed. The window for creating a new element is displayed: click "Window" then "Window".
    • The wizard for window creation starts.
    • In the wizard, select "Blank" and validate.
  2. 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").
  3. Save the window.
  4. 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:
  1. 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.
  2. 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).
  3. In the "Content" tab of the description window of the supercontrol, specify:
    • the file browsed: RADFileB.
    • the item browsed: IDRADFileB.
Creating the Table section:
  1. Create a Table control in the window ("Insert .. Control .. Table").Create a Table control in the window: on the "Creation" pane, in the "Data" group, expand "Table and list box" and select "Table (Vertical)".
  2. 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.
  3. Position the Table control in the window and define its size. The columns corresponding to the identifiers can be invisible if necessary.
  4. 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).
  5. 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").
  6. 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.")
    RETURN
    END
    // Open the form window of RADFileC
    Open(WIN_Form_RADFileC)

    Note: default link buttons are also required. See Creating the link buttons for more details.
  7. 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 the controls
    IF TABLE_RADFielD..Occurrence = 0 THEN
    Error("RADFileD must be entered")
    RETURN
    END
    // Update the HyperFileSQL context
    ScreenToFile()
    // Add or modify RADFileB
    IF RADFileB..NewRecord = True THEN
    HAdd(RADFileB)
    ELSE
    HModify(RADFileB)
    END
    // 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
    TableSave(TABLE_RADFileD)
    END
    // Return value
    MyWindow..ReturnedValue = True
  8. 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
    //1: R&ecord
    //2: &Don't save
    //3: Cancel
    SWITCH Dialog("A record is currently created.")
    //1: R&ecord
    CASE 1:
    // Runs the click code of the validate button:
    // save the current data
    ExecuteProcess(BTN_Validate, trtClick)
    //2: &Don't save
    CASE 2 // The window will be closed without backup
    //3: &Cancel
    CASE 3: RETURN
    END
    END
  9. Initialization code of the window:
    // Display the records
    FileToScreen()
    // Filter for the table of FileD
    HFilter(RADFileD, RADFileBRelID, RADFileB.RADFileBID)
    // Default return value
    MyWindow..ReturnedValue = False
  10. Closing code of window. This code is used to disable the filter:
    // Disables the filter
    HDeactivateFilter(RADFileD)
Minimum required version
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment