460 likes | 473 Views
Learn how to create and customize stacked and content canvases in a slide presentation. Create a new form module and data block for EMPLOYEE and EMPLOYEETYPE tables. Set up canvases and windows for displaying employee information and adding new employee types.
E N D
Stacked Canvas A content canvas is a main from canvas while a stacked canvas is a secondary canvas that overlays or partially covers a content canvas. In other words, it can be stacked on another canvas. Thus in this slide presentation a content canvas will be made first, followed by a stacked canvas.
Highlight the Module and create a new data block for the EMPLOYEETYPE table
Deselect Auto-join. This data block should not be related to EMPLOYEE
Use the Frame Title, Employee Type Details Only display one record
The canvas for Employee Type Details In the Layout Editor, resize this stacked canvas to the Following: Height 75 Width 410
Change the name of the Content Canvas to EMPLOYEES Change the name of the Stacked Canvas to EMPLOYEE_TYPE Name changes can be done in the Property Palette or on the Object Navigator. In using the Object Navigator, highlight the object to be changed. Ensure that the highlight is blue, not yellow, and change the name.
Highlight the form window, WINDOW1. Open the Property Palette and set these properties: Name: PRINCIPAL_WINDOW Title: EMPLOYEE CHANGE FORM Primary Canvas: EMPLOYEES
Highlight Windows and create a new window by clicking Edit, Create
The new window, WINDOW11 has been created. Open the Property Palette and set these properties: Name: EMPLOYEE_TYPE Title: ADD NEW TYPE Primary Canvas: EMPLOYEE_TYPE
For the EMPLOYEE_TYPE window, set these additional properties: X Position: 20 Y Position: 50 Width: 410 Height :75
Open the Property Palette for the EMPLOYEE_TYPE canvas Change the window to EMPLOYEE_TYPE
Locate the EMPLOYEETYPE item in the EMPLOYEE data block and create a When-Validate-Item trigger
Enter this source code for the trigger For the explanation of %ROWTYPE see the next slide
%ROWTYPE Attribute The %ROWTYPE attribute provides a record type that represents a row in a database table. The record can store an entire row of data selected from the table or fetched from a cursor or cursor variable. Variables declared using &ROWTYPE are treated like those declared using a datatype name. %ROWTYPE can include all the columns in a table: emp_rec employee%ROWTYPE; Or a subset of the columns, based on a cursor: CURSOR XYZ IS SELECT DepartmentNumber, DepartmentName FROM departments; Dept_rec XYZ%ROWTYPE; Columns in such rows have the same names and datatypes, but do not inherit constraints such as NOT NULL or default values.
Open the Layout Editor for EMPLOYEE Add a button next to Emp. Type
Push Button has been added. Open the property Palette and give it the following properties: Name: ADD_TYPE Label: ADD TYPE
Create a When-Button-Pressed trigger for the ADD_TYPE item. With Triggers highlighted, click Edit, Create
Enter this code Go_block navigates to the indicated data block. If the target block is non-enterable, an error occurs. The syntax: Go-block (‘Block Name’);
Open the Property Palette for the data block EMPLOYEETYPE. Set the following properties: Update Allowed: No Delete Allowed: No Query Allowed: No
1. Compile and run the form. Enter Ctrl-F11 to enter data on the form. You must be connected to the database! 2. Enter an invalid Emp. Type 3. This warning is given
Change the Emp. Type back to its original value and click the ADD TYPE button
The stacked canvas, ‘Employee Type Details’ appears on the top of the content canvas, ‘Employee Details’. • Notice that there are two windows: • EMPLOYEE CHANGE FORM • ADD NEW TYPE • The ADD NEW TYPE window is the active window.
3. Click Save 2. Click Insert record 4. A new record will have been added to the database 1. Enter a new Emp. Type as shown