Presentation is loading. Please wait.

Presentation is loading. Please wait.

Eyad Alshareef, Edited by: Mostafa Ali

Similar presentations


Presentation on theme: "Eyad Alshareef, Edited by: Mostafa Ali"— Presentation transcript:

1 Eyad Alshareef, Edited by: Mostafa Ali
Creating Custom Forms Part B Eyad Alshareef, Edited by: Mostafa Ali

2 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

7 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

8 Eyad Alshareef, Edited by: Mostafa Ali
Messages Syntax: MESSAGE(‘message text’); Message Eyad Alshareef, Edited by: Mostafa Ali

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

10 Eyad Alshareef, Edited by: Mostafa Ali
Alerts Form-level object Object properties define alert appearance Message Title Style icon Buttons Eyad Alshareef, Edited by: Mostafa Ali

11 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

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

13 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

14 Eyad Alshareef, Edited by: Mostafa Ali
Example Alert Eyad Alshareef, Edited by: Mostafa Ali

15 Eyad Alshareef, Edited by: Mostafa Ali
Syntax to Display an Alert and Execute Alternate Commands Depending on the Button the User Clicked Eyad Alshareef, Edited by: Mostafa Ali

16 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

18 Text Item Validation Properties
Eyad Alshareef, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

21 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

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

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

25 Forms Builder Built-in Procedures for Handling Errors
Eyad Alshareef, Edited by: Mostafa Ali

26 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

27 Data Blocks vs. Control Blocks
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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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 Flushes block Makes information consistent with corresponding database data Eyad Alshareef, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

39 Block Navigation Order
Block order Canvas order doesn’t matter Eyad Alshareef, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

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, Edited by: Mostafa Ali

44 Eyad Alshareef, Edited by: Mostafa Ali
Tap Canvas Eyad Alshareef, Edited by: Mostafa Ali

45 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

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

47 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

48 Eyad Alshareef, Edited by: Mostafa Ali
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, Edited by: Mostafa Ali

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

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, Edited by: Mostafa Ali

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

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

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

54 Eyad Alshareef, Edited by: Mostafa Ali
Stacked Canvas Eyad Alshareef, Edited by: Mostafa Ali

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

56 Stacked Canvas Example
Content canvas Stacked canvas Eyad Alshareef, Edited by: Mostafa Ali

57 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 Create block items on the stacked canvas Create buttons and triggers to display and hide the stacked canvas Eyad Alshareef, Edited by: Mostafa Ali

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

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


Download ppt "Eyad Alshareef, Edited by: Mostafa Ali"

Similar presentations


Ads by Google