1 / 59

Chapter 9 Adding Menus, Popup Menus, Alerts, Timers, and Hierarchical Tree Items to Forms

Chapter 9 Adding Menus, Popup Menus, Alerts, Timers, and Hierarchical Tree Items to Forms. In this chapter you will: Use menus to consolidate applications into systems Create and use popup menus Use alerts to grab an operator’s attention Create timers in your forms

studs
Download Presentation

Chapter 9 Adding Menus, Popup Menus, Alerts, Timers, and Hierarchical Tree Items to Forms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 9 Adding Menus, Popup Menus, Alerts, Timers, and Hierarchical Tree Items to Forms Oracle9i Developer: Developing Web Applications with Forms Builder

  2. In this chapter you will: • Use menus to consolidate applications into systems • Create and use popup menus • Use alerts to grab an operator’s attention • Create timers in your forms • Add and use hierarchical tree items • Create database objects through your form • Trap and handle error messages • Learn about mouse events Oracle9i Developer: Developing Web Applications with Forms Builder

  3. Using Menus to Consolidate Applications into Systems • Systems contain a large number of applications that operators access. • Operators must be able to easily and handily call each of the system’s forms. • Drop-down menus enable operators to quickly find needed forms and task options. • Menus can consists of submenus that allow the operator to open additional palettes to the right of the option. Oracle9i Developer: Developing Web Applications with Forms Builder

  4. Using Menus to Consolidate Applications into Systems Oracle9i Developer: Developing Web Applications with Forms Builder

  5. Using Menus to Consolidate Applications into Systems • Drop-down menus that appear at the top of the form are not part of the form module. • Drop-down menus are modules of their own and are associated to the form using the Menu Module property. • Each application can have its own menu or can assume the menu of a calling application. • Forms Builder menu modules have a file extension of .mmb. • Compiled menu modules have a file extension of .mmx. Oracle9i Developer: Developing Web Applications with Forms Builder

  6. Using Menus to Consolidate Applications into Systems • Menu modules have the the following objects: • Attached libraries • Menus • Object groups • Program units • Property classes • Visual attributes • The Menus objects group has the menu palettes that contain the menu options. Oracle9i Developer: Developing Web Applications with Forms Builder

  7. Using Menus to Consolidate Applications into Systems Oracle9i Developer: Developing Web Applications with Forms Builder

  8. Using Menus to Consolidate Applications into Systems • The Menu Editor graphically depicts the menus. • The Menu Editor is opened by double-clicking a menu module object. • The Menu Editor has a Create Down tool for creating an option below the current item. • The Menu Editor has a Create Right tool which creates a new submenu that is called from the item. • The Delete tool is used to delete the current menu item. Oracle9i Developer: Developing Web Applications with Forms Builder

  9. Using Menus to Consolidate Applications into Systems • A menu item can execute one of five different types of statements or commands. • Null - Specifies that the item does not perform an action. It is used for separator items. • Menu - Calls another menu object contained in the Menu object section. • PL/SQL - Invokes a PL/SQL script or built-in subprogram. • Plus - Opens an SQL*Plus session. • Macro - Executes an SQL*Menu macro and should be avoided. Oracle9i Developer: Developing Web Applications with Forms Builder

  10. Using Menus to Consolidate Applications into Systems • The Command Type property determines the type of command used by the menu item. • Commands are entered into the Command Text property using the PL/SQL editor. • The PL/SQL editor is launched by double-clicking the menu item on the Object Navigator. Oracle9i Developer: Developing Web Applications with Forms Builder

  11. Using Menus to Consolidate Applications into Systems • Menus have a security tool that can be used to prevent an operator from executing certain items. • Menu security is based upon database roles. • Menu modules have a Module Roles property used to record the roles that can access the menu items. • The roles are entered into the Menu Modules Roles dialog box. Oracle9i Developer: Developing Web Applications with Forms Builder

  12. Using Menus to Consolidate Applications into Systems Oracle9i Developer: Developing Web Applications with Forms Builder

  13. Using Menus to Consolidate Applications into Systems • Menu items have two properties that control access to the option. • Item Roles - Determines the roles that can access the option. • Display Without Privilege - Determines whether the option is displayed on the menu when the operator has not been granted the role. Oracle9i Developer: Developing Web Applications with Forms Builder

  14. Using Menus to Consolidate Applications into Systems • The Menu Type property controls the type of menu item. Options are: • Plain - Consists of a menu option displaying text (default). • Radio - Places radio buttons on the menu. • Check - Places a check box next to the item that can be toggled on and off. • Separator - Displays a horizontal line. Used to segregate options. • Magic - Associates the menu item to a standard operating system function such as copy. Oracle9i Developer: Developing Web Applications with Forms Builder

  15. Using Menus to Consolidate Applications into Systems Oracle9i Developer: Developing Web Applications with Forms Builder

  16. Using Menus to Consolidate Applications into Systems • Magic items can also display the operating system’s hot keys adjacent to the name of the function. • Forms Builder will also enable or disable the menu option if it cannot be used. For example, the Copy function is only enabled if a value is selected. • The default menu module is called Default&Smartbar. It cannot be modified. • Forms Builder provides a replica menu module called Menudefs.mmb that can be modified. Oracle9i Developer: Developing Web Applications with Forms Builder

  17. Using Menus to Consolidate Applications into Systems • Menu items have a number of properties of note: • Command Text • Command Type • Display Without Privilege • Enabled • Keyboard Accelerator • Icon Filename • Icon in Menu • Item Roles • Label Oracle9i Developer: Developing Web Applications with Forms Builder

  18. Using Menus to Consolidate Applications into Systems • Additional menu item properties of note: • Magic Item • Menu Item Code • Menu Item Radio Group • Menu Item Type • Submenu • Visible in Horizontal Toolbar • Visible in Vertical Toolbar • Visible in Menu Oracle9i Developer: Developing Web Applications with Forms Builder

  19. Using Menus to Consolidate Applications into Systems • A form has an internal menu object called a Popup Menu. • Popup menus are similar to a regular menu except they are launched by clicking the right mouse button over a data block item or canvas. • Popup menus are associated to a data block item or canvas using the data block item or canvas’ Popup Menu property. Oracle9i Developer: Developing Web Applications with Forms Builder

  20. Using Menus to Consolidate Applications into Systems Oracle9i Developer: Developing Web Applications with Forms Builder

  21. Using Menus to Consolidate Applications into Systems • Menu items can be displayed as tools on the toolbar using the following properties: • Icon Filename • Visible in Horizontal Toolbar • Visible in Vertical Toolbar Oracle9i Developer: Developing Web Applications with Forms Builder

  22. Using Alerts to Grab an Operator’s Attention • An alert is a form object that consists of modal dialog box that displays a message and has one or more buttons that must be pressed before the alert can be closed. • The operator is forced to press one of the buttons before continuing with the session. • Alerts are often used to warn an operator about an event. Oracle9i Developer: Developing Web Applications with Forms Builder

  23. Using Alerts to Grab an Operator’s Attention • There are three styles of alerts: • Stop • Caution • Note • Each of the styles displays a different symbol in the dialog box. Oracle9i Developer: Developing Web Applications with Forms Builder

  24. Using Alerts to Grab an Operator’s Attention Oracle9i Developer: Developing Web Applications with Forms Builder

  25. Using Alerts to Grab an Operator’s Attention • Alerts have several properties of note: • Alert Style • Button 1 Label • Button 2 Label • Button 3 Label • Default Alert Button • Message • Title Oracle9i Developer: Developing Web Applications with Forms Builder

  26. Using Alerts to Grab an Operator’s Attention • The alert can display three different buttons, but must display at least one. • If a button label property is blank, the button will not display. • Alerts are displayed using the Show_alert built-in. • Show_alert is a function and it returns a value indicating which button was pressed. • It is a good practice to have a single generic alert and change the alert’s properties with the Set_alert_property built-in. Oracle9i Developer: Developing Web Applications with Forms Builder

  27. Using Alerts to Grab an Operator’s Attention • The following is a template of a typical statement launching an alert. • Declare • Alert_button number; • Begin • Set_alert_property (‘alert_name’, title, ‘Error’); • Set_alert_property (‘alert_name’, alert_message_text, • ‘Alert_message’); • Alert_button := show_alert(‘alert_name’); • if alert_button = 1 then • action1 • else • action 2 • end if; • End; Oracle9i Developer: Developing Web Applications with Forms Builder

  28. Creating Timers • Forms Builder has a tool called a timer that fires a When-Timer-Expired trigger when the allotted time is expended. • Timers track time in milliseconds and are created using the Create_timer built-in. • The Create_timer built-in has three settings: • Name of the timer • Number of milliseconds • A repeat/no_repeat value Timer := Create_time(‘timer_name’, 60000, no_repeat); Oracle9i Developer: Developing Web Applications with Forms Builder

  29. Creating Timers • When-Trigger-Expired trigger template • Declare • timer_that_expired timer; • Begin • timer_that_expired := get_application_property(timer_name); • if timer_that_expired = ‘first_time’ then • action1; • else • action2; • end if; • End; Oracle9i Developer: Developing Web Applications with Forms Builder

  30. Creating Timers • Multiple timers can be created. • Each works autonomously and causes a When-Timer-Expired trigger to fire when the time is elapsed. • The Delete_timer built-in is used to destroy the time. • The Set_timer built-in is used to change the timer settings. Oracle9i Developer: Developing Web Applications with Forms Builder

  31. Adding and Using Hierarchical Tree Items • Forms Builder has the ability to display a set of data as a hierarchical tree. • It is a tree with nodes that expands displaying increasingly more detailed information about the parent record. • Hierarchical tree items are actually data block items that display a Select statement result set. Oracle9i Developer: Developing Web Applications with Forms Builder

  32. Adding and Using Hierarchical Tree Items Oracle9i Developer: Developing Web Applications with Forms Builder

  33. Adding and Using Hierarchical Tree Items Oracle9i Developer: Developing Web Applications with Forms Builder

  34. Adding and Using Hierarchical Tree Items • The Select statement that populates the hierarchical tree must contain five expressions: • State - Determines whether the node is expanded or collapsed. (Expression 1) • Level - Determines the node on which the data is displayed. (Expression 2) • Value - Determines the displayed value. (Expression 3) • Icon - Determines the icon displayed before the node. (Expression 4) • Primary Key- Contains a value used to identify child records. (Expression 5) Oracle9i Developer: Developing Web Applications with Forms Builder

  35. Adding and Using Hierarchical Tree Items • The most difficult part of creating a hierarchical tree item is to sort and rank the values. • Result set values generally do not match the order that they need to be sorted in. Oracle9i Developer: Developing Web Applications with Forms Builder

  36. Adding and Using Hierarchical Tree Items Oracle9i Developer: Developing Web Applications with Forms Builder

  37. Adding and Using Hierarchical Tree Items • Unless the data is in a unary relationship a special Select statement will need to be created using a view. • Data from a unary relationship comes from the same table and the levels can be calculated using the Connect By clause. Oracle9i Developer: Developing Web Applications with Forms Builder

  38. Adding and Using Hierarchical Tree Items • More commonly, hierarchical data is contained in multiple tables related in a binary one-to-many relationship. • The data source will likely consist of a series of unionized Select statements with each statement returning records for a different node. • It is virtually impossible to sort the data from the different Select statements properly without a special technique. This technique is a view with a computed sort expression. Oracle9i Developer: Developing Web Applications with Forms Builder

  39. Adding and Using Hierarchical Tree Items • The view is needed in order to create a sixth expression that can be used to sort records. • The sort expression is a concatenation of the parent record primary keys along with the primary key of the current record. • This special expression is used in the Order By clause and will properly sort the records under the proper parent. Oracle9i Developer: Developing Web Applications with Forms Builder

  40. Adding and Using Hierarchical Tree Items Oracle9i Developer: Developing Web Applications with Forms Builder

  41. Adding and Using Hierarchical Tree Items • Creating a hierarchical tree item is no different than creating a data item on a control block. • Hierarchical tree items must be placed on a control block and they must be the only item on the block. • The Select statement is placed into the Data Query property. Oracle9i Developer: Developing Web Applications with Forms Builder

  42. Adding and Using Hierarchical Tree Items • Hierarchical items contain the following properties of note: • Allow Empty Branches • Data Query • Multi-Selection • Record Group • Show Line • Show Symbols Oracle9i Developer: Developing Web Applications with Forms Builder

  43. Adding and Using Hierarchical Tree Items • Hierarchical tree items are populated by the Populate_tree procedure. • The procedure is part of the Ftree package. • The procedure can be placed in a When-Button-Pressed trigger or a When-New-Form-Instance trigger. • Hierarchical tree items are similar to a LOV. They execute a Select statement and place the values into memory. This can cause a performance problem when large result sets are returned. Oracle9i Developer: Developing Web Applications with Forms Builder

  44. Adding and Using Hierarchical Tree Items • If the result set is large it is best to populate the tree item incrementally. • This means the child records are only returned to the item as the nodes are expanded. • This requires the creation of a separate view for each level returned. The parent’s primary key value is used in the Select statement to return the proper records. Oracle9i Developer: Developing Web Applications with Forms Builder

  45. Adding and Using Hierarchical Tree Items Oracle9i Developer: Developing Web Applications with Forms Builder

  46. Adding and Using Hierarchical Tree Items Oracle9i Developer: Developing Web Applications with Forms Builder

  47. Adding and Using Hierarchical Tree Items • A When-Tree-Node-Activated trigger can be used to launch the Select statement. • The trigger executes an Ftree.Add_tree_date built-in that will populate the target node. Oracle9i Developer: Developing Web Applications with Forms Builder

  48. Adding and Using Hierarchical Tree Items • The Ftree package contains a number of built-ins of note: • Add_tree_data • Add_tree_node • Delete_tree_node • Find_tree_node • Get_tree_node_parent • Get_tree_node_property • Get_tree_property Oracle9i Developer: Developing Web Applications with Forms Builder

  49. Adding and Using Hierarchical Tree Items • Additional Ftree package built-ins of note: • Get_tree_selection • Populate_group_from_tree • Populate_tree • Set_tree_node_property • Set_tree_property • Set_tree_selection Oracle9i Developer: Developing Web Applications with Forms Builder

  50. Creating Database Objects Through Your Form • Forms Builder has a built-in called Forms_ddl that allows the developer to create database objects from the form at runtime. • The built-in allows the developer to create tables that hold form data, messages, or created data. • The built-in also allows the developer to create custom DML and SQL statements at runtime. Oracle9i Developer: Developing Web Applications with Forms Builder

More Related