Creating Custom Forms - PowerPoint PPT Presentation

1 / 44
About This Presentation
Title:

Creating Custom Forms

Description:

Creating Custom Forms Chapter 6 Lesson A Objectives Learn about custom forms Create a custom form Create command buttons that use form triggers to manipulate data Use ... – PowerPoint PPT presentation

Number of Views:111
Avg rating:3.0/5.0
Slides: 45
Provided by: Jama81
Category:
Tags: creating | custom | forms

less

Transcript and Presenter's Notes

Title: Creating Custom Forms


1
Creating Custom Forms
  • Chapter 6

2
Lesson A Objectives
  • Learn about custom forms
  • Create a custom form
  • Create command buttons that use form triggers to
    manipulate data
  • Use the Forms Debugger to find form logic and
    runtime errors
  • Learn how form triggers work
  • Create form navigation triggers

3
Custom Forms
  • Display the data fields from a variety of
    database tables
  • Contain programs that support organizational
    processes
  • Not associated with one table
  • When creating custom forms
  • Identify the processes that the form is intended
    to support, then identify the associated database
    tables.
  • Helpful to draw interface on paper

4
Creating a Custom Form
  • Manually create the form canvas in the Object
    Navigator
  • Create the form items by painting the items on
    the canvas, using tools on the Layout Editor tool
    palette
  • Write the code that controls the form functions
  • Use a control data block
  • Not associated with one database table
  • Contains manually drawn form items
  • Controlled with form triggers

5
System Date and Time Variables
6
Creating Command Buttons
  • Create a command button by drawing the button on
    the canvas using the Button tool
  • Create button triggers manually for custom forms
  • Trigger fires on WHEN-BUTTON-PRESSED event
  • If multiple buttons execute similar actions (like
    clearing a form) create a separate program unit
    for this action

7
Sample Button Trigger Commands
8
Using the Forms Debugger to Find Runtime Errors
  • Use the Forms Debugger to find runtime errors
    that occur while a form is running
  • Identify the program line that is causing the
    error, and examine the variable values used
    within the command that has the error
  • Investigate the nature of the error by looking up
    the error code explanation
  • Error codes with the FRM- prefix are Forms
    Builder error codes
  • Error codes with the ORA- prefix are generated by
    the DBMS
  • Look up error code on otn.oracle.com

9
Using the Forms Debugger
  • Click the Run Form Debug button on the Forms
    Builder toolbar
  • Set a breakpoint, which pauses execution on a
    specific program command
  • To debug
  • Examine the current values of all program
    variables
  • Step through the program commands to observe the
    execution path
  • Examine variable values to see how the values
    change

10
Setting a Breakpoint
11
Forms Debug Console Windows
12
Viewing Text Item Values
13
Form Trigger Categories
14
Trigger Properties
  • Trigger timing
  • Specifies when a trigger fires
  • Can be just before, during, or after its
    triggering event
  • Before PRE-
  • After POST-
  • During WHEN-, ON-, KEY-
  • Trigger scope
  • Defines where an event must occur in order for
    trigger to fire
  • Includes the object to which the trigger is
    attached, and contained objects

15
Trigger Properties
  • Trigger execution hierarchy
  • Defines which trigger fires when an object within
    a form object contains the same trigger that the
    form object contains
  • Can specify custom execution hierarchy

16
Directing Form External Navigation
  • Form focus currently selected item has form
    focus
  • External navigation
  • Occurs when the user causes the form focus to
    change by making a different form item active
  • Internal navigation
  • Occurs as a result of internal form code that
    responds to external navigation operations or
    trigger commands
  • Use external navigation to
  • Specify initial form focus when form opens
  • Specify tab order

17
Setting Tab Order in Object Navigator
18
Directing External Navigation Using Built-in
Subprograms
19
Lesson B Objectives
  • Learn about default system messages and how to
    suppress them
  • Create alerts and messages to provide system
    feedback
  • Create applications that avoid user errors
  • Learn how to trap common runtime errors

20
System Message Severity Levels
21
Suppressing Messages
  • SYSTEM.MESSAGE_LEVEL
  • Variable used to suppress error messages
  • Set to 0, 5, 10, 15, 20, 25 to suppress all
    messages with severity below this level
  • Default value is 0
  • Set value in PRE-FORM trigger

22
Providing System Feedback
  • Custom message
  • A short text string displayed on the form message
    line
  • Use when the form needs to provide a short,
    simple message that does not require an
    acknowledgement from the user
  • To create MESSAGE('message_string')
  • Can be up to 200 characters

23
Alerts
  • Dialog box that can display a longer text message
  • Displays one or more buttons that allow the user
    to select between alternatives that execute
    associated program statements
  • Use when
  • Message is longer than 200 characters
  • User acknowledgement is required
  • User choice is required
  • See Figure 6-22 for example alert

24
Displaying an Alert
  • In a form trigger
  • DECLARE
  • alert_button NUMBER
  • BEGIN
  • alert_button SHOW_ALERT('alert_name')
  • END
  • Use ELSIF structure to interpret and act on user
    response

25
Avoiding User Errors
  • Forms should help users avoid errors by
  • Validating input values
  • Programmatically disabling form command buttons
  • Disabling navigation for form text items
    containing values that users should not change

26
Text Item Validation
27
Form Validation Triggers
  • Item validation triggers
  • Perform complex validations
  • Associate with WHEN-VALIDATE-ITEM event
  • Trigger code tests the current item value to
    determine if it satisfies the validation
    condition
  • If input not valid, form displays a message and
    raises a built-in exception named
    FORM_TRIGGER_FAILURE

28
Disabling Form Command Buttons
  • Disable command buttons to prevent users from
    pressing them before form is in proper state
  • SET_ITEM_PROPERTY('UPDATE_BUTTON', ENABLED,
    PROPERTY_FALSE)

29
Disabling Text Item Navigation
  • Prevent users from modifying primary key values
  • Make text item nonnavigable
  • user cannot press the Tab key to place the
    insertion point in the text item
  • To prevent user clicking item
  • Create a trigger that moves the insertion point
    to another form item whenever the user clicks the
    text item using the mouse

30
Trapping Common Runtime Errors
  • Provide better error messages for common errors
  • Create form-level trigger for ON-ERROR event

31
Syntax for ON-ERROR Trigger
32
Lesson C Objectives
  • Convert data blocks to control blocks
  • Link data blocks to control blocks
  • Create a form that has multiple canvases
  • Create tab canvases
  • Create stacked canvases

33
Converting a Data Block to a Control Block
  • Save time by creating a data block and converting
    to a control block
  • To convert data block to control block
  • Change the data blocks Database Data Block
    property value to No
  • Change the Required property value of the text
    item that represents the data block tables
    primary key to No

34
Linking a Data Block to a Control Block
  • Useful in complex forms with master-detail
    relationships
  • Master is control block, details are data blocks
  • To link a control block with a data block
  • Create the control block
  • Create the data block
  • Specify the link between the control block and
    the data block
  • Modify the form triggers to refresh the data
    block when the underlying data values change

35
Control/Data Block Form Example
36
Creating Forms with Multiple Canvases
  • Use multiple screens to avoid displaying too much
    information
  • Single-form approach
  • Create one form with multiple canvases
  • Enables the form to share data among the
    different canvases
  • Impossible for multiple programmers to work
    simultaneously on different canvases of the same
    application
  • Multiple-form approach
  • Create multiple forms with a different .fmb file
    for each application canvas
  • Works well when multiple programmers collaborate
    to create a complex application

37
Viewing Canvas and Block Information
38
Creating Multiple Canvas/Block Forms
  • Specify block and canvas ordering in Object
    Navigator
  • To navigate to another canvas programmatically,
    use GO_ITEM to navigate to an item on the canvas
  • Refer to items in triggers with syntax
    block_name.item_name
  • Use caution to make sure items are placed in
    correct blocks

39
Creating and Configuring Tab Canvases in Forms
  • Multiple-page canvases that allow users to move
    between multiple canvas surfaces by selecting
    tabs at the top of the canvas.
  • Use to
  • Display a large number of related items in a
    modular way
  • Direct a user through a sequence of steps for
    performing a task
  • Lies on top of a content canvas within the form
    window.
  • Tab page
  • An object representing a surface that displays
    form items
  • Has a tab label identifier at the top

40
Creating a Tab Canvas
  • To create
  • Create the form
  • Create a new content canvas in the form
  • Create a tab canvas on the content canvas
  • Configure the tab pages

41
Creating a Tab Canvas
42
Creating and Configuring Stacked Canvases in Forms
  • Lies on top of a content canvas
  • Use to hide canvas objects and then make the
    objects appear as needed
  • Create by
  • Painting canvas in the desired position on an
    existing content canvas
  • Configure stacked canvas properties
  • Create the form items that are to appear
  • Write form triggers that contain commands to
    display the stacked canvas when it is needed and
    to hide the stacked canvas when it is not needed

43
Configuring a Stacked Canvas
44
Summary
  • Control blocks are created manually and do not
    represent data from only one table
  • Control blocks can be created from data blocks to
    make coding easier
  • Forms Debugger is used to find runtime errors in
    forms
  • User errors should be avoided by limiting
    opportunities for error
  • User feedback is presented in message line and
    alert boxes
  • A form may contain more than one canvas canvases
    can be organized using tabs or shown and hidden
    programmatically
Write a Comment
User Comments (0)
About PowerShow.com