- The steps for creating a RAD pattern
- Which pages must be created?
- The files to create
- Standard to follow
- The Form pages
- Overview
- To create a form page:
- Case of print buttons
Creating the Form pages of a WEBDEV RAD pattern
The steps for creating a RAD pattern Which pages must be created? 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 RADFileB/RADFileD relation page.
The main menu of the site can be included in the template associated with the pages. Standard to follow This help page presents the rules that apply when creating the pages of the RAD Pattern. These rules have been used to create the different patterns supplied with WEBDEV 16. These rules are recommendations. You can implement and use your own standard. Overview A form page contains the following elements: - A supercontrol: This supercontrol contains the controls of the form to display. This supercontrol is linked to the file to display.
- Buttons used to Validate or Cancel (back button).
- Vision Plus buttons used to select elements of another file in a specific page (for the forms regarding RADFileB and RADFileC only).
Remark: If the pattern uses a menu, we recommend that you insert this menu in the page template used by the pattern. Therefore, the menu will be accessible from all the generated pages. Example of Form page for the Intranet pattern: To create a form page: - Click
in the quick access buttons. - The creation window appears: click "Page" then "Page".
- The page creation wizard starts.
- Select "Blank". You can select the template used in your pattern.
- In the description window, enter the name of the page. This name must necessarily contain the name of the file displayed in the form (some examples: PAGE_Form_RADFileA, PAGE_For_RADFileA, ...).
Remark: If you want to indicate the name of the current file to the user, use the name of the file (RADFileA for example) in a caption. The RADFileX term will be automatically replaced by the caption of the file described in the analysis. - Save the page.
- Create a supercontrol in the page: 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 page 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: RADFileXX ("RADFileA" for example).
- the item browsed: IDRADFileXX ("IDRADFileA" for example).
- Create and position the different buttons of your page: validation button, back button. These buttons can have any name.
- Case of validation button ("OK" or "Validate" button for example).
In the code of the validation button, we advise you to enable the automatic management of errors ("If Error: ", with the automatic process "Run the error process ("CASE ERROR:" in the code)"). The code of the validation button can be (for a form on RADFileA):
// Read the information entered PageToFile() // If it's a new record IF RADFileA..NewRecord = True THEN // Add it HAdd(RADFileA) ELSE // Modify it HModify(RADFileA) END // Back to the previous page IF PreviousPage() = "" THEN PageDisplay(PreviousPage) ELSE PageDisplay(PAGE_Home) END
CASE ERROR: Error("An error occurred during the validation.", HErrorInfo()) RETURN
- Case of return button ("Back" button for example).
// Are we coming from a page? IF PreviousPage() = "" THEN // Yes, display this page PageDisplay(PreviousPage()) ELSE // No, go back to the home page PageDisplay(PAGE_Home) END
Remark: This code requires the presence of a page named "PAGE_Home" in the RAD pattern. This page can be the home page of the site and it can contain the main menu of the site. For more details, see Menu page. - Enter the initialization code of the page. Example:
// Display the records FileToPage()
This code is used to display the value of the records in the form. - Add the Vision Plus buttons if necessary (for the RADFileB and RADFileC forms).
Case of print buttons A RAD pattern can contain buttons used to start a print. The code of these buttons must allow you to start the print of the report. The reports must be created in the project of the RAD pattern: - The name of these reports must contain RADFileX. For better readability, we recommend that you use "Form" or "Table" in the name of the form to easily identify the type of the report.
- This name must be used in the code of the print button:
// Create a unique file name sFile is string = fDataDir() + "\" + DateSys() + TimeSys() + ".pdf" // Print the report in a PDF file iDestination(iPDF, sFile) // Generate the report iPrintReport(RPT_List_RADFileA) // Display the report in PDF format FileDisplay(sFile, "application/pdf") // Delete the file fDelete(sFile)
CAUTION: There is no need to customize the reports found in your project of the RAD pattern. Indeed, during the generation, only the name of the report will be kept. If the "Print" button is found in a "Form" page, the printed report will be a Form report. If the "Print" button is found in a "Table" page, the printed report will be a Table report.
|
|
|
|