• 200 likes • 387 Views
Chapter 6 Lesson C. Creating Custom Forms. 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. Converting a Data Block to a Control Block.
E N D
Chapter 6Lesson C Creating Custom Forms
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
Converting a Data Block to a Control Block • We can create a control block: • Manually and drawing the layout by hand • Create a data block using the Data Block Wizard and Layout Wizard, then convert it to a control block.
Converting a Data Block to a Control Block • There are two steps required to convert a data block to a control block: • Change the data block’s Database Data Block property value to No • Change the Required property value of the text item that represents the data block table’s primary key to No
Linking a Data Block to a Control Block • It is often advantageous to create a form that contains a mix of data blocks and control blocks • Often the blocks are linked with a master-detail relationship
Creating the Data Block • When linking a data block to a control block, the Data Block Wizard cannot be used to create the master-detail relationship • Instead, the data block should be created without any relationship
Linking the Control Block and the Data Block • In order to establish the link between the data and control blocks, the data block’s WHERE Clause property is set. The general syntax for this is: fieldname = :control_block.text_item_name
Refreshing the Data Block Values • In order to refresh the values of the data block to match the control block, the following commands are used: GO_BLOCK('ENROLLED_STUDENTS'); EXECUTE_QUERY; • The GO_BLOCK built-in navigates to the block, while EXECUTE_QUERY refreshes the data.
Creating Forms with Multiple Canvases • A well-designed form does not present too much information to the user at one time • Using multiple canvases helps to divide information into smaller pieces • There are two options for creating forms with multiple canvases: • The single-form approach • The multiple-form approach
Creating Forms with Multiple Canvases • The Single-form Approach • This approach makes it easy to share data between the forms. • However, since only one form design file (.fmb) exists, only one programmer can work on the canvases at a time. • The multiple-form approach • involves the creation of a form design file for each canvas • This approach allows multiple developers to work on a project and facilitates the reuse of forms • However, it is more difficult to share information among the canvases.
Working with Multiple Canvases and Data Blocks • When a form contains multiple canvases, it is necessary to specify the canvas on which a data block will appear • When each block item is added, the canvas should also be specified • It is common to create multiple data blocks when working with multiple canvases • This allows the data items to be grouped in small manageable units • It is also needed if there are two items with the same name, since items must have unique names within a data block
Specifying the Block Navigation Order • When a form contains multiple canvases, the canvas that appears first is the canvas whose block items appear first under the Data Blocks node in the Object Navigator window • Notethat the order of the canvases is irrelevant; only the order of the blocks matters
Referencing Different Canvases, Form Blocks, and Block Items • Forms Builder always displays the canvas containing the item with the form focus • Therefore, the GO-ITEM built-in can be used to display a different canvas by placing the focus on an item in that canvas • It is a good idea to always preface the item name with the block name using the format: block_name.item_name • If two items have the same name but reside in different blocks, and the GO-ITEM built-in references only the item name, a runtime error will occur
Creating and Configuring Tab Canvases in Forms • A tab canvas displays multiple canvases that the user can navigate between by clicking a labeled tab at the top of the canvas • They are convenient for organizing a lot of form items or allowing users to navigate through a series of steps
Creating a Tab Canvas • Each tab canvas contains tab pages • Steps: • Creating the form • Creating a new content canvas in the form • Creating a tab canvas on the content canvas • Configuring the tab pages
Creating Form Items on a Tab Canvas • Form items are placed on a tab page just like on any other canvas