Along with the classes, AppWizard creates a dialog template resource named IDD_DAOENROL_FORM
, which the CDaoRecordView-derived class, CSectionForm
, uses to display its form controls. Because CDaoRecordView is derived from CFormView, a record view’s client area is laid out by a dialog template resource. The layout of the form is up to you. AppWizard places one static text control on the dialog template resource, labeled “TODO: Place form controls on this dialog.”
In the following procedure, you’ll replace this text with controls that correspond to columns in the table (via the field data members of the recordset). The table below lists the columns and their associated edit control IDs and variable names.
DaoEnrol's Controls and Member Variables
Column name | Control ID | Variable Name |
Course | IDC_COURSE |
|
Section | IDC_SECTION |
|
Instructor | IDC_INSTRUCTOR |
|
Room | IDC_ROOM |
|
Schedule | IDC_SCHEDULE |
|
Capacity | IDC_CAPACITY |
|
To customize DaoEnrol’s form
The dialog editor opens and displays the dialog box with the corresponding ID.
Tip Press ALT+ENTER to display the Properties window, and then pin it down so it stays open while you add and edit the dialog box controls.
Resize the dialog box as needed. You may want to add the controls in pairs, for example: static text control, then the corresponding edit control, and so on.
IDC_COURSE
). This is only a convention, but it is used throughout the tutorial.Note The “Edit” caption that appears in each edit control is not visible to the user at run time, so you needn’t worry about deleting it. To view the dialog box as it will appear at run time, press CTRL+T to enter test mode for the dialog box. Press ESC to cancel test mode.
According to a common rule in the user interface design of database forms, the user shouldn’t be able to update these key fields. If users want to change a course number or section of a Section record, they must delete the old Section record and add a new one to avoid possibly violating the referential integrity of the database. DaoEnrol Step 3 implements Add and Delete functionality.
It’s a good idea to periodically back up your work.
The Layout of DaoEnrol’s Section Form
If you did not add the static text and corresponding edit controls in order, one after the other, you need to change the tab order. You can easily check the current tab order and change it if necessary.
To view or change the tab order of controls
You’ll see numbers depicting the current tab order of the controls.
As you click, you’ll see the numbering change to reflect your choices.
For DaoEnrol, specify a tab order such that each edit control is preceded in the tab order by the static text control that describes it. By specifying this tab order, you enable ClassWizard to derive a name for the edit control when you bind it to a data member, as you’ll do in the next topic.