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
  • Difference between Mobile and Smartphone
  • Standard to follow
  • The relation windows in mobile
  • Overview
  • Creating a relation window for a Mobile pattern
  • The relation windows in Smartphone
  • Overview
  • Creating a relation window for a Smartphone pattern
  • Creating the form window on RADFileD
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 Mobile RAD pattern
The steps for creating a RAD pattern
The steps for creating a WINDEV Mobile 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.

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:
  1. 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.
  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 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.
  5. 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:
  1. 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.
  2. 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).
  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 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)".
  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 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).
  5. 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:
    // Check the controls
    IF TABLE_RADFielD..Occurrence = 0 THEN
    Error("RADFileD must be entered")
    RETURN
    END
    // Update the HFSQL context
    ScreenToFile()
    // Add or modify RADFileB
    IF RADFileB..NewRecord = True THEN
    HAdd(RADFileB, hIgnoreIntegrity)
    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
  6. 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").
  7. 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").
  8. 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 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)
  9. Initialization code of the window:
    // Display the records
    FileToScreen()
    // Filter for the table of FileD
    HFilter(RADFileD, RADFileBRelID, RADFileB.RADFileBID)
  10. Closing code of window. This code is used to disable the filter:
    // Disables the filter
    HDeactivateFilter(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.
Example: Relation window in the simple RAD pattern:

Creating a relation window for a Smartphone pattern

To create a relation window for a Smartphone pattern:
  1. Select "File .. New .. Window", then "Blank window wizard". Keep the default options.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". Keep the default options.
  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. 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".
  5. 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.
  6. 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
  1. 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.
  2. 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).
  3. 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
  1. 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)".
  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 with direct access".
    • 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.
Creating the menus and the menu options
  1. 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.
  2. 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 record
    HReset(RADFileD)
    // Open the form of RADFileD file in creation mode
    Open(WIN_Form_RADFileD)
    // Refresh the table
    TableDisplay(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 mode
    Open(WIN_Form_RADFileD)
    // Refresh the table
    TableDisplay(TABLE_RADFileD, taCurrentSelection)

    The "Delete row" option is used to delete the current row:
    // Asks to confirm the deletion
    SWITCH YesNo("Do you want to delete the record?")
    CASE Yes
    // Delete the RADFileD record from the table
    TableDelete(TABLE_RADFileD)
    // Position on the current record
    TableDisplay(TABLE_RADFileD, taCurrentFirst)
    CASE No
    // No action
    END
  3. Case of the option used to access RADFileC
    This option is a link option. The code associated with this option is as follows:
    // 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)
  4. Code of the menu option for closing:
    // Close the window
    Close()
  5. Initialization code of the window:
    // Display the records
    FileToScreen()
    // Default return value
    MyWindow..ReturnedValue = False

Creating the form window on RADFileD

  1. Select "File .. New .. Window", then "Blank window wizard". Keep the default options.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".
    • Keep the default options.
  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_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").
  3. Save the window.
  4. 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.
  5. 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).
  6. Display the characteristics of the supercontrol in the modifier. In the "Analysis" category, specify:
    • the file browsed: RADFileD.
    • the item browsed: IDRADFileD.
  7. Modify the menu found in the window:
    • a menu option must allow you to validate the window.
      // Read the information entered
      ScreenToFile()
      // If it's a new record
      IF RADFileD..NewRecord = True THEN
              // Add it
              HAdd(RADFileD)
      ELSE
              // Modify it
              HModify(RADFileD)
      END
      // Return value of the window
      MyWindow..ReturnedValue = True
      // Close the window
      Close()
    • a menu option must allow you to close the window.
      // Return value of the window
      MyWindow..ReturnedValue = False
      // Close the window
      Close()
  8. 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 RADFileB
Select "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 RADFileB
Select "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 RADFileB
IF Open(WIN_Vision_RADFileB) = True THEN
        // Refreshes the content of the IDRADFileB combo box
        ListDisplay(COMBO_IDRADFileB, taCurrentFirst)
END
8.3. Combo box on RADFileC
Select "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).
9. Initialization code of the window:
// Display the records
FileToScreen()
// Display the linked information
SC_Form.COMBO_IDRADFileC = RADFileC.IDRADFileC
SC_Form.COMBO_IDRADFileC..State = Grayed
// Default return value
MyWindow..ReturnedValue = False
Minimum required version
  • Version 12
Comments
Click [Add] to post a comment