Presentation is loading. Please wait.

Presentation is loading. Please wait.

Eyad Alshareef 1 Creating Custom Forms Part B. 2Eyad Alshareef Lesson B Objectives After completing this lesson, you should be able to: Suppress default.

Similar presentations


Presentation on theme: "Eyad Alshareef 1 Creating Custom Forms Part B. 2Eyad Alshareef Lesson B Objectives After completing this lesson, you should be able to: Suppress default."— Presentation transcript:

1 Eyad Alshareef 1 Creating Custom Forms Part B

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

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

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

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

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

7 7Eyad Alshareef 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

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

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

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

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

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

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

14 14Eyad Alshareef Example Alert

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

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

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

18 18Eyad Alshareef Text Item Validation Properties

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

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

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

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

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

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

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

26 26Eyad Alshareef Lesson C Objectives After completing this lesson, you should be able to: Convert data blocks to control blocks Convert data blocks to control blocks Link data blocks to control blocks Link data blocks to control blocks Create a form that has multiple canvases Create a form that has multiple canvases Create tab canvases Create tab canvases Create stacked canvases Create stacked canvases

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

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

29 29Eyad Alshareef Converting a Data Block to a Control Block Create a data block and layout that contains most of the required text items 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: Convert the data block to a control block by changing the following block property: Database Data Block = No Database Data Block = No Then change the following text property: Then change the following text property: Required = No Required = No

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

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

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

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

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

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

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

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

38 38Eyad Alshareef Block Navigation Order First block in Object Navigator Data Blocks list determines block items that first appear when form opens 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 Users can use the Tab key to navigate among different block items Canvas that contains block items automatically appears Canvas that contains block items automatically appears

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

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

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

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

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

44 Eyad Alshareef 44 Tap Canvas

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

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

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

48 48Eyad Alshareef 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 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 By default, a new tab canvas has 2 tab pages Create new tab pages as needed Create new tab pages as needed Adjust tab page properties Adjust tab page properties

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

50 50Eyad Alshareef Adjusting the Tab Page Order Tab page that appears first is tab page whose block items appear first in the Object Navigator 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

51 51Eyad Alshareef Creating and Configuring Tab Canvases in Forms Tab canvases Tab canvases Multiple-page canvases Multiple-page canvases Allow users to move between multiple canvas surfaces Allow users to move between multiple canvas surfaces By selecting tabs at top of canvas By selecting tabs at top of canvas Display large number of related items in modular way Display large number of related items in modular way Direct user through sequence of steps for performing task Direct user through sequence of steps for performing task

52 52Eyad Alshareef Creating a Tab Canvas Contains two or more tab pages Contains two or more tab pages Tab page Tab page Object representing surface Object representing surface Displays form items Displays form items Has tab label identifier at top Has tab label identifier at top

53 53Eyad Alshareef Creating Form Items on a Tab Canvas Use tab pages as any content canvas Use tab pages as any content canvas Create items on tab pages Create items on tab pages Using Data Block Wizard Using Data Block Wizard By creating control block and drawing text items directly on tab canvases By creating control block and drawing text items directly on tab canvases Must be sure to specify placement of items on tab canvas Must be sure to specify placement of items on tab canvas

54 Eyad Alshareef 54 Stacked Canvas

55 55Eyad Alshareef Stacked Canvases Canvas that appears on an existing content canvas, and can be displayed or hidden as needed Canvas that appears on an existing content canvas, and can be displayed or hidden as needed Allows user to configure canvas items Allows user to configure canvas items

56 56Eyad Alshareef Stacked Canvas Example Stacked canvas Content canvas

57 57Eyad Alshareef Creating a Stacked Canvas Use the Stacked Canvas tool on the Layout Editor tool palette to draw a stacked canvas on an existing content canvas Use the Stacked Canvas tool on the Layout Editor tool palette to draw a stacked canvas on an existing content canvas Create block items on the stacked canvas Create block items on the stacked canvas Create buttons and triggers to display and hide the stacked canvas Create buttons and triggers to display and hide the stacked canvas

58 58Eyad Alshareef Displaying and Hiding a Stacked Canvas Displaying a stacked canvas: Displaying a stacked canvas: GO_BLOCK(‘stacked_canvas_block’); SHOW_VIEW(‘stacked_canvas’); Hiding a stacked canvas: Hiding a stacked canvas: GO_BLOCK(‘content_canvas_block’); HIDE_VIEW(‘stacked_canvas’);

59 59Eyad Alshareef Lesson C Summary Convert data block to control block Convert data block to control block Create relationship between control block and data block Create relationship between control block and data block Display information on multiple canvases: Display information on multiple canvases: Single-form approach Single-form approach Multiple-form approach Multiple-form approach Tab canvas Tab canvas Multiple-page canvas Multiple-page canvas


Download ppt "Eyad Alshareef 1 Creating Custom Forms Part B. 2Eyad Alshareef Lesson B Objectives After completing this lesson, you should be able to: Suppress default."

Similar presentations


Ads by Google