1 / 59

Creating Custom Forms

Creating Custom Forms. Part B. Lesson B Objectives. After completing this lesson, you should be able to: Suppress default system messages Create alerts and messages to provide system feedback to users Create applications that avoid user errors Trap common runtime errors.

riona
Download Presentation

Creating Custom 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. Creating Custom Forms Part B Eyad Alshareef

  2. Lesson B Objectives After completing this lesson, you should be able to: • Suppress default system messages • Create alerts and messages to provide system feedback to users • Create applications that avoid user errors • Trap common runtime errors Eyad Alshareef

  3. Controlling System Messages • Forms Services message line • Displays FRM- and ORA- messages • Classified according to • Severity • Whether or not they require user intervention • Suppress default system messages • Replace with custom messages • Set :SYSTEM.MESSAGE_LEVEL variable • In PRE-FORM trigger Eyad Alshareef

  4. Oracle Error Message Severity Levels • 5: informative message (one record saved) • 10: informative message advising user of procedural error (cannot insert character ) • 20: condition that keeps trigger from working correctly • 25 condition that keeps form from working correctly • >25: extreme severity (out of memeory) Eyad Alshareef

  5. Providing System Feedback • Important application design principle • Provide users with feedback about what is happening in application • Make applications forgiving • Allow users to undo unintended operations Eyad Alshareef

  6. Suppressing Lower Level System Messages • Set :SYSTEM.MESSAGE_LEVEL variable to a higher level in PRE-FORM trigger :SYSTEM.MESSAGE_LEVEL := 25; Eyad Alshareef

  7. Providing User Feedback in Forms • Message • Text in message line at bottom of form • Informational only; user doesn't have to respond • Alert • Dialog box • Allows user to choose different ways to proceed Eyad Alshareef

  8. Messages • Syntax: MESSAGE(‘message text’); Message Eyad Alshareef

  9. Custom Messages • Short text string that displayed on form message line • Up to 200 characters • Syntax: • MESSAGE('message_string'); Eyad Alshareef

  10. Alerts • Form-level object • Object properties define alert appearance Message Title Style icon Buttons Eyad Alshareef

  11. Alerts • Dialog box • Display text message longer than 200 characters • Displays one or more buttons • Allow user to select between alternatives that execute associated program statements • Top-level form object Eyad Alshareef

  12. Alerts (continued) • Styles: • Note • Caution • Stop • Button Label property determines: • How many buttons appear on alert • Labels on buttons • Maximum 3 buttons Eyad Alshareef

  13. Alerts (continued) • Create alert from Alert Navigation node • To declare/display alert: DECLARE alert_button NUMBER; BEGIN alert_button:= SHOW_ALERT('alert_name'); END; Eyad Alshareef

  14. Example Alert Eyad Alshareef

  15. Syntax to Display an Alert and Execute Alternate Commands Depending on the Button the User Clicked Eyad Alshareef

  16. Avoiding User Errors • Help users avoid errors • Configure forms that validate input values • Programmatically disable form command buttons • Disable navigation for form text items containing values that users should not change Eyad Alshareef

  17. Validating Form Input Values • Validate input values • Ensure that values meet specific preset requirements • Use • Text item validation properties • Form validation triggers • Validation unit • Represents largest chunk of data that user can enter before form validates all input values Eyad Alshareef

  18. Text Item Validation Properties Eyad Alshareef

  19. Validating Form Input Values (continued) • Item validation trigger • Item-level trigger • Associate with item’s WHEN-VALIDATE-ITEM event • Fires when item validated • As determined by form validation unit • If not valid • Raises built-in exception named FORM_TRIGGER_FAILURE Eyad Alshareef

  20. Disabling Form Command Buttons to Avoid User Errors • Enable or disable button while form running: • SET_ITEM_PROPERTY('item_name', property_name, property_value); Eyad Alshareef

  21. Validation Triggers • When Validate Item • It should be Item level trigger. • Executes when the item validation occurs depending on Validation Unit property. • E.g. : IF NOT :student.s_class IN (‘FR’,’SO’) THEN Message(‘Legal Values are FR and SO); RAISE FORM_TRIGGER_FAILURE; END IF; Eyad Alshareef

  22. How To Disable Buttons • SET_ITEM_PROPERTY • E.g. : SET_ITEM_PROPERTY(‘Control.Delete’ , ENABLED, PROPERTY_FALSE); Eyad Alshareef

  23. Disabling Text Item Navigation • Nonnavigable • User cannot press Tab key to place insertion point in text item • Set item’s Keyboard Navigable property to No • User can still click mouse pointer in text item to enter value • Create trigger that moves insertion point to another form item • WHEN-MOUSE-UP event Eyad Alshareef

  24. Trapping Form Runtime Errors • ON-ERROR event occurs • Whenever ORA- or FRM- error occurs while form running • Create form-level trigger that corresponds to ON-ERROR event • Use decision control structure to handle different errors Eyad Alshareef

  25. Forms Builder Built-in Procedures for Handling Errors Eyad Alshareef

  26. Lesson C Objectives After completing this lesson, you should be able to: • 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 Eyad Alshareef

  27. Data Blocks vs. Control Blocks • Data block • Easy to create and use • Is associated with a single table, and reflects the table’s structure • Control block • Requires a lot of custom programming • Can contain items from many different tables • You can link data and control blocks to take advantages of the strengths of each Eyad Alshareef

  28. Converting a Data Block to a Control Block • Use Data Block and Layout Wizards to create data block form and form layout • Convert data block to control block • Add command buttons to control form processing • Simplify creation of control blocks Eyad Alshareef

  29. Converting a Data Block to a Control Block • Create a data block and layout that contains most of the required text items • Convert the data block to a control block by changing the following block property: • Database Data Block = No • Then change the following text property: • Required = No Eyad Alshareef

  30. Linking a Data Block to a Control Block • Create forms that link data blocks and control blocks to work together • Usually represent master-detail relationship Eyad Alshareef

  31. Linking Data Blocks and Control Blocks • Create the control block as the master block • Create the data block as the detail block, but do not create a master-detail relationship • Create a master-detail relationship manually in the WHERE Clause property of the detail block: data_block_field = :control_block.text_item Eyad Alshareef

  32. Creating the Data Block • Use Data Block Wizard and Layout Wizards • To create and configure data block • Must contain field that links it to control block • Create data block without master-detail relationship • Link two blocks later Eyad Alshareef

  33. Linking the Control Block and the Data Block • Open detail data block’s Property Palette • Modify data block’s WHERE Clause property • General syntax: • fieldname := control_block.text_item_name Eyad Alshareef

  34. Displaying and Refreshing the Data Block Values • Create a trigger to: • Place the insertion point in the data block GO_BLOCK(‘data_block_name’); • Flush the data block to make its data consistent with the master block and the database: EXECUTE_QUERY; Eyad Alshareef

  35. Refreshing the Data Block Values • Add commands to: • Initially populate data block display • Periodically refresh data block records • Use the GO_BLOCK built-in: • To move form focus to data block • Then execute EXECUTE_QUERY built-in • Flushesblock • Makes information consistent with corresponding database data Eyad Alshareef

  36. Creating Forms with Multiple Canvases • Good practice not to show too much information on user’s screen display • Single-form approach • Create one form with multiple canvases • Enables form to share data among different canvases • Impossible for multiple programmers to work simultaneously on different canvases of same application Eyad Alshareef

  37. Creating a Form with Multiple Canvases • Users should be able to see all canvas text items without scrolling • For complex applications with many text items, divide application into multiple canvases Eyad Alshareef

  38. Block Navigation Order • First block in Object Navigator Data Blocks list determines block items that first appear when form opens • Users can use the Tab key to navigate among different block items • Canvas that contains block items automatically appears Eyad Alshareef

  39. Block Navigation Order Block order Canvas order doesn’t matter Eyad Alshareef

  40. Working with Multiple Canvases and Data Blocks • Create form that contains multiple canvases • Create individual canvases • Specify to display specific block items on specific canvas • Create new data block • Select canvas name on which block items appear • On Layout Wizard Canvas page Eyad Alshareef

  41. Working with Multiple Canvases and Data Blocks (continued) • Often forms that have multiple canvases also have multiple data blocks • Group items that appear on same canvas in single data block • To keep blocks small and manageable • Cannot create two items that have same name in same data block • Ensure that Forms Builder places new items in correct block Eyad Alshareef

  42. Specifying the Block Navigation Order • Specify which canvas initially appears when user runs form • Canvas whose block items appear first under Data Blocks node in Object Navigator window • Order of canvases in Object Navigator Canvases list does not matter • Only order of data blocks Eyad Alshareef

  43. Referencing Different Canvases, Form Blocks, and Block Items • All form items have Canvas property • Specifies name of canvas on which item appears • Form always displays canvas on which item with focus appears • Execute GO_ITEM built-in • Move form focus to item on target canvas • Good practice to include block name Eyad Alshareef

  44. Tap Canvas Eyad Alshareef

  45. Canvas • It is the surface that has the form items on it. • It has many types: • Content (The default) • Tab • Stacked • … • All canvases inside some window must have the property ‘Window’ has the name of the enclosing window. Eyad Alshareef

  46. Tab Canvases • Multiple-page canvases that allow users to move among different canvas surfaces by clicking tabs Eyad Alshareef

  47. Tab Canvas Components • Tab canvas • Collection of related tab pages • Tab pages • Surfaces that display form items • Tab labels • Identifier at top of tab page • A tab canvas lies on top of a content canvas Eyad Alshareef

  48. Creating a Tab Canvas • Use the Tab Canvas tool on the Layout Editor tool palette to draw a tab canvas on an existing content canvas • By default, a new tab canvas has 2 tab pages • Create new tab pages as needed • Adjust tab page properties Eyad Alshareef

  49. Important Tab Page Properties Name: how the page Is referenced in the form Label: Caption that appears on the associated tab Eyad Alshareef

  50. Adjusting the Tab Page Order • Tab page that appears first is tab page whose block items appear first in the Object Navigator Block order Tab page order doesn’t matter Eyad Alshareef

More Related