You are on page 1of 87

Enhanced Guide to Oracle8i Chapter 11: Creating an Integrated Database Application

Steps for Creating an Integrated Database Application

Design

Create the specifications for the individual applications

Module Development

Create the individual forms, reports and charts


Integrate the individual components into a single application

Module Integration

Steps for Creating an Integrated Database Application

Testing

Unit testing System testing Packaging the integrated modules into an installable format

Deployment

Reasons for Integrating Multiple Form Modules

Breaks project down into independent modules that are easier to work with and debug Keeps size of .fmx files smaller Makes it easier for application to be worked on by project teams

Steps for Integrating Application Modules


Place all of the application modules (forms, reports, graphics) in a common folder Create a main form module to integrate all of the applications

Main Form Components

Splash screen

Introduces application

Switchboard

Provides easy access to most-used features


Provide access to all application components
6

Pull-down menus

Main Form Screen Design


Custom pull-down menus
Graphic image

Switchboard

Form Global Variables

Variables that can be referenced by any open form Remain in memory even after form in which they are created is closed Character variables, with maximum length of 255 characters Syntax for creating and assigning a value:
:GLOBAL.variable_name := value;

Global Path Variables

In an integrated database application, the main form calls other application module files A global path variable references a text string that stores the complete folder path to all application module files If application location is changed, only the global path variable needs to be changed

Creating a Global Path Variable

Created in PRE-FORM trigger of main application form Example syntax:

:GLOBAL.project_path := c:\oraclesolutions\chapter11 \tutorialsolutions\cwproject_done\;

10

Main Form Splash Screen


Forms Runtime window Splash screen

11

Splash Screen Behavior

User starts application, and splash screen appears briefly Then, main form window displays switchboard and pull-down menus

12

Creating a Splash Screen


Create the splash art using a graphics art application In the main form module, create separate data blocks, windows, and canvases for the splash screen and for the main form
Blocks

Canvases

Windows
13

Configuring the Splash Screen Window


Configure the splash window using the dialog window style
Document windows:
Non-modal: allow user to multitask in multiple windows Show pull-down menus and the Forms Runtime toolbar

Dialog windows
Modal: user must close window before working in another window Appear in a separate window frame Do not display pull-down menus
14

Creating and Displaying the Splash Screen


1. 2.

Create an image item on the splash canvas Create a PRE-FORM trigger to load the splash art file into the image item when the form starts using the READ_IMAGE_FILE procedure
full path location to splash art file file image type

image item on splash canvas

15

Form Timers

Created programmatically to control time-based form events When you create a timer, you specify the duration until the timer expires When the timer expires, the form WHEN-TIMER-EXPIRED trigger fires

16

Creating a Timer to Control the Splash Screen Display


Create a timer to specify how long the splash image is displayed

Set the timer

timer name

interval until timer expires (in milliseconds)

parameter specifying that timer is not automatically reset

17

Displaying the Main Form


Create a WHEN-TIMER-EXPIRED trigger that fires when timer expires Displays main application form window, hiding splash screen window

18

Configuring the Main Form Blocks


To ensure that the splash window appears first when the form is started, the splash block must be listed first in the Object Navigator window

19

Template Forms

Generic forms that include objects that will be used on all application forms

Graphic images Toolbars Program units Window configurations Etc.

20

Using a Template Form

Create template form and store it in a central location When developers make a new form, they start with the template form, save it using a different filename, and then add specific items

21

Visual Attribute Groups

Form object that defines object properties


Colors Font sizes and styles Other properties

22

Creating a Visual Attribute Group

Create a Visual Attribute Group object in the template form

23

Creating a Visual Attribute Group

Define the Visual Attribute Group properties on its Property Palette


24

Applying a Visual Attribute Group to a Form Item

To apply a Visual Attribute Group to a form item, open the item Property Palette and select the Visual Attribute Group

25

Procedures to Open a Form From Another Form

CALL_FORM

Opens a child form and immediately switches the focus to the child form

OPEN_FORM

Opens a child form with the option of not immediately switching focus to the child form Opens a child form and closes the parent form

NEW_FORM

26

The CALL_FORM Procedure


Syntax:
CALL_FORM(form_specification, display, switch_menu, query_mode, parameter_list_id);

Parameters:
Form_specification: full path and filename to new forms .fmx file, or form module name as specified in Object Navigator Display: specifies whether the calling form is hidden by the called form
HIDE: hides calling form NO_HIDE: calling form is not hidden, and user can multi-task between the two forms
27

The CALL_FORM Procedure


CALL_FORM(form_specification, display, switch_menu, query_mode, parameter_list_id);

Parameters (continued):
Switch_menu: specifies whether the child form inherits the calling forms pull-down menus
NO_REPLACE - menus are inherited by called form DO_REPLACE - menus are not inherited by called form; called form displays its own menus

Query_mode: specifies whether form runs in Normal or Query mode


NO_QUERY_MODE: normal mode, user can change data QUERY_MODE: user can only view data

Parameter_list_id: ID of optional parameter list

28

Example CALL_FORM Command

Full path to child forms .fmx file Parent form will be hidden

Child form will not inherit calling forms menus

29

The OPEN_FORM Procedure


Syntax:
OPEN_FORM(form_specification, activate_mode, session_mode, parameter_list_id);

Parameters:
Activate_mode: specifies whether the application focus switches to the child form
ACTIVATE: focus switches NO_ACTIVATE: focus remains on parent form

Session_mode: specifies whether the child form uses the same database session as the parent form
NO_SESSION: child form shares parent forms session SESSION: child form opens new session
30

The NEW_FORM Procedure


Syntax:
NEW_FORM(form_specification, rollback_mode, query_mode, parameter_list_id);

Parameters:
Rollback_mode: specifies whether uncommitted transactions in the parent form are committed or rolled back when the parent form is closed
TO_SAVEPOINT: uncommitted transactions are rolled back to the last savepoint NO_ROLLBACK: uncommitted transactions are not rolled back FULL_ROLLBACK: all uncommitted transactions are rolled back
31

Procedures to Navigate Among Open Forms

GO_FORM

Moves focus to the specified form

NEXT_FORM

Moves focus to the next form


Moves focus to the previous form

PREVIOUS_FORM

32

The GO_FORM Procedure


Syntax:
GO_FORM(form_identifier);

Parameter:
Form_identifier: form ID or form specification
Form_ID: unique ID given to form when it is opened; Can be retrieved using FIND_FORM procedure Form specification: form name, as specified in the Object Navigator

33

The NEXT_FORM and PREVIOUS_FORM Procedures


When a new form is opened, a sequential form ID value is assigned to it
NEXT_FORM opens next form in sequence PREVIOUS_FORM opens previous form in sequence

34

Procedures to Close Forms

CLOSE_FORM

Closes the specified form

EXIT_FORM

Closes the current form, and provides options for committing or rolling back the uncommitted transactions

35

The CLOSE_FORM Procedure


Syntax:
CLOSE_FORM(form_identifier);

Parameter:
Form_identifier: form ID or form specification
Form_ID: unique ID given to form when it is opened; Can be retrieved using FIND_FORM procedure Form specification: form name, as specified in Object Navigator

36

The EXIT_FORM Procedure


Syntax:
EXIT_FORM(commit_mode, rollback_mode);

Parameters:
Commit_mode
ASK_COMMIT: ask user whether to commit DO_COMMIT: automatically commits all transactions NO_COMMIT: discards uncommitted transactions

Rollback_mode: same as for NEW_FORM procedure


37

WHEN-WINDOW-CLOSED Triggers
Form-level trigger Fires when user clicks the Close button on a form window title bar Code syntax: EXIT_FORM;

38

Project Builder
Developer utility to help project developers organize and manage individual form, report, and graphic files in an integrated database application
Provides a central access point for all project files Allows developers to selectively recompile project files Aids in deploying the finished project

39

Creating a New Project


Use the Project Wizard to specify:
Project registry (.upd) file
Contains project information and references to project form, report, and graphics files

Project definitions, including title and folder where project files are stored Project default database connection User information (author name, comments) References to files that are included in the project
40

Project Navigator Window


Toolbar

Launcher

Nodes display area

41

Project Navigator Window Components

Launcher

Secondary toolbar to access other Developer utilities Shows Project Builder and project components

Nodes display area

42

Project Builder Components

Global registry

Specifies types of files that can be included in projects

User registry

Stores user-specific configuration information


Specifies database connection information that can be applied to projects Nodes corresponding to individual projects
43

Connections

Projects

Project Properties

Specified on project Property Palette

44

Project Files and Dependencies


Dependencies: conditional relationships that show how certain files depend on the existence of other files
Target (executable) files depend on input (source code) files
Input file .fmb .rdf .ogd Target file .fmx .rep .ogr

Project Builder automatically deduces file dependencies


45

Project Navigator Views


Project view: displays project files sorted by file type

46

Project Navigator Views


Dependency view: displays project target files with associated input files

Target file Input file

47

Project File Properties

Project files have 2 types of properties:

Properties specific to the file

Examples: file name, file type Examples: directory, author, database connection

Properties inherited from the project

48

Project File Property Palette


Specific properties

Inherited properties

49

Managing Project Components Using Project Builder

Project Builder allows you to:


Add and delete project files Access and modify project files in their underlying Developer utility Create and assign database connections to projects Create subprojects Build (compile) project files
50

Adding and Deleting Project Files

To add a new file to a project, select the project in the Project Navigator, and click the Add Files to Project button To remove a file from a project, select the file, and then click the Delete button
51

Opening and Modifying Project Components

To start a specific Developer utility with no file loaded, click the appropriate button on the Launcher toolbar

Form Builder

Report Builder
Graphics Builder

Procedure Builder
Query Builder

52

Opening and Modifying Project Components

To start a specific Developer utility with a specific file loaded, click the icon beside the document file

53

Project Database Connections


Specify a database username, password, and connect string that can be assigned to a project Allows developers to launch and edit project files in Form Builder, Report Builder, and Graphics Builder without having to explicitly log onto the database
54

Creating a Project Database Connection

Select the Connections node, and then click the Create button Open the new connection Property Palette, and specify the connection information
55

Subprojects

Large projects can be divided into subprojects that are easier to manage

Subproject information is added to parent project registry file

Subprojects do not create a separate registry file


56

Creating a Subproject

Make sure that no project is currently selected, and then start the Project Wizard Select the Create a sub-project under an existing project option button, and then click Next

57

Creating a Subproject

Select the parent project and click Next Specify the rest of the project properties

58

Building Project Input Files


Options for building (compiling) input files in Project Builder:
Build Selection : only builds the currentlyselected input file Build Incremental : builds all target files whose associated input files have been changed but not yet rebuilt Build All: builds all project files

To save development time, only build files when the associated input files have changed
59

Opening and Closing Projects and Saving Project Files


When you create a new project, the project always appears in the Project Navigator unless you explicitly close the project All project changes are automatically saved in the project registry file

60

Delivering a Project

Process of preparing the completed application for deployment to users Steps

Prepare the files for delivery

Move them to the staging area (folder or CDROM)

Generate scripts for installing the project using the Oracle Installer
61

Using the Delivery Wizard


Project files can be prepared for delivery using the Delivery Wizard Delivery Wizard Pages

Project setup: specifies project name and whether project is a new project or a patch for an existing project Staging area: specifies the staging area location Files: specifies the project files to be delivered Subdirectories: specifies the folder to which the files will be delivered Finish: summarizes the delivery information
62

Customizing the Project Builder Environment

Preferences dialog box allows you to configure:


Project Navigator toolbar Pages that appear in wizards Default project information for all projects Project Navigator display Launcher toolbar

To open the Preferences dialog box, click Tools on the menu bar, and then click Preferences
63

Form Menus

Pull-down menus

Allow users to click a top-level choice on the menu bar, and display related selections

Menu toolbars

Toolbars that display iconic buttons corresponding to pull-down menu selections


Context-sensitive Appear when user right-clicks the mouse pointer on a specific object
64

Pop-up menus

Pull-Down Menus
Menu modules are separate modules built in Form Builder
Design file: .mmb extension Compiled file: .mmx extension

A menu module can be attached to one or more form modules

65

Pull-Down Menus

A menu module can contain multiple menu items Menu items are sets of menu selections that appear on the menu bar

Menu module
Menu item

66

Menu Item Components


Parent menu items: top-level menu selections Menu handle: allows you to detach the menu and move it to a different location Child menu items: lowest-level menu selections
Have associated menu code triggers that performs a form action

Menu item

Parent menu items Menu handle Individual menu Child menu items
67

Creating a Menu Module

Select the Menus node in the Object Navigator, and click the Create button to create a new menu module Double-click the Menu Module icon beside the new menu module to open the Menu Editor

68

Using the Menu Editor


Change the first item label Click the Create Right button create new parent menu items Click the Create Down button create new child menu items

to

to

69

Important Menu Item Properties


Specifies whether the item is enabled or grayed out Specifies how item appears in menu

Specifies whether item is visible or hidden Allows you to implement menu security based on database roles
70

Menu Item Types

Plain

Regular menu item Specifies a property that is enabled or disabled Specifies a selection in a group of related selections, of which only one can be selected Separator bar Predefined menu types
71

Check

Radio

Separator

Magic

Window Menu Selection


Forms Runtime automatically places Window as the last menu selection in a menu module
Window is always last menu selection

72

Access Keys
Access key: key user can press to activate a pulldown menu selection
Parent menu items: press access key plus Alt Child menu items: press access key alone

Default access key: first letter of menu label


To use a different letter in the menu label, preface the letter in the label with an ampersand (&)

Modified access key


73

Displaying a Custom Menu on a Form


Change the Form Menu Module property to the full path to the menu module .mmx file
Always remember to rebuild the .mmx file after modifying an .mmb file so the modified menu appears in the form

Path to menu module .mmx file


74

Displaying an Alternate Menu on a Called Form

By default, child forms display their parent forms custom menus To display an alternate menu, specify DO_REPLACE in the CALL_FORM procedure:

CALL_FORM(:GLOBAL.project_path || customer.fmx, HIDE, DO_REPLACE);

75

Menu Toolbars

Display iconic buttons that appear horizontally or vertically on a form toolbar Have equivalent pull-down menu selections

Horizontal toolbar

76

Creating a Menu Toolbar

Open the Property Palette of the corresponding menu item, and change the items Visible in Horizontal or Vertical Menu Toolbar property to Yes
77

Pop-up Menus

Context-sensitive menus that appear when the user right-clicks when the pointer is on a specific form item Associated with a specific form Exist as top-level form objects
78

Creating a Pop-up Menu

Create a new Pop-up Menu object in the Object Navigator Specify the menu code trigger associated with the pop-up menu Attach the pop-up menu to one or more form items

79

Attaching a Pop-up Menu to a Text Item

Pop-up menu name


80

Menu Security

You can enforce application security by:

Allowing certain users to use a pull-down menu module Allowing certain users to user specific pulldown menu selections

Selections are disabled for unauthorized users

81

Implementing Menu Module Security

Steps:

Enable the security function in the module Specify the database roles that can access the menu module Specify the database roles that can access specific menu items

82

Enabling the Security Function in the Menu Module

Set the module Use Security property to Yes

83

Specifying Roles for a Menu Module

Open the menu module Property Palette, and specify the roles in the Menu Module Roles dialog box
84

Specifying Roles for Menu Items

Open the menu item Property Palette, click the Item Roles property, and select the desired roles in the Menu Item Roles dialog box
85

Controlling Menu Items Programmatically

You can use the SET_MENU_ITEM_PROPERTY procedure to change menu item properties at runtime

Disable/enable menu items Change menu labels

86

The SET_MENU_ITEM_PROPERTY Procedure

Syntax:

SET_MENU_ITEM_PROPERTY (menu_specification, property_name, value);

Parameters:
Menu_specification: either the menu ID or menu item name Property_name: name of property being set Value: new property value
87

You might also like