Step 3. Create Tab Folder Form
VFW005 – Basic Windows Controls
Use a
to create a folder with several sheets to provide an organized way of showing a large amount of information.Objectives
To create the form shown below, containing a tab folder with three tab sheets.
- When an employee number is entered on the Employee tab sheet, the employee details such as Surname, Given Name and Salary are to be displayed on the Details tab sheet.
- When the Skills tab is selected, a list of employee skills is to be shown
Note: This is a very simple example application and is not typical of the way that tab sheets interaction would be designed.
1. Create a new form:
iiiTabFolder
A Simple Tab Folder
2. Drag and drop a
to the form, and resize it to occupy most of the form.3. With the
selected, drag and drop a onto the Tab Folder.4. Click on the area to the right of the tab sheet, to select the
, and drop another onto the folder.5. Repeat step 4. So that the
contains 3 .6. Select the first Tab Sheet by clicking on the tab and then clicking on the main tab sheet area.
If you hover over the tab sheet, the component name will be shown in a tooltip:
a. Change the tab sheet Employee.
property tob. Select the second tab sheet and change its Details.
property toc. Select the third tab sheet and change its Skill.
property to7. On the
tab, expand the group and expand the file definition, PSLMST.8. Select the Employee tab sheet and drop the EMPNO field onto it.
9. Select the Details tab sheet and drop SURNAME, GIVENAME and SALARY onto it.
10. On the
tab, expand the file definition PSLSKL.11. Select the Skill tab sheet and drop fields SKILCODE, GRADE, COMMENT and DATEACQ onto it.
12. Create an Opening event routine for
(TBSH_2).Add code to initialize the fields SURNAME. GIVENAME and SALARY and then Fetch them from the file PSLMST with the key EMPNO.
Your code should look like the following:
Evtroutine Handling(#TBSH_2.Opening) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
#SURNAME #GIVENAME #SALARY := *default
Fetch Fields(#SURNAME #GIVENAME #SALARY) From_File(pslmst) With_Key(#EMPNO)
Endroutine
13. Create an Opening event routine for
(TBSH_3).Add code to initialize the fields SKILCODE, GRADE, COMMENT and DATEACQ and then fetch them from the file PSLSKL with the key EMPNO.
Your code should look like the following:
Evtroutine Handling(#TBSH_3.Opening) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
#SKILCODE #GRADE #COMMENT #DATEACQ := *default
Fetch Fields(#SKILCODE #GRADE #COMMENT #DATEACQ) From_File(pslskl) With_Key(#EMPNO)
Endroutine
Note: The editor will give a warning because the key does not match the file keys. This logic will fetch the first skill record for the employee only. The actual file key is EMPNO and SKILCODE because the employee may have a number of skills.
14. Compile and run the form.
a. On the Employee tab sheet enter and employee number such as A1012 or, A1013.
b. Select the Details and then Skill to display employee data.