Page 191 - DCAP408_WEB_PROGRAMMING
P. 191

Unit 11: Dialog Boxes (I)




          5.   In the caption box, modify the caption to Pen Widths. Observe that the title bar of the  Notes
               dialog box reflects the new caption.
          6.   Save your work.

          11.3.2 Adding the  Controls


          To add controls to the dialog box:
          1.   From the Controls toolbar, add two edit box controls to the Box1 dialog box.
                   Choose  the  first  edit  box  to  exhibit  its  property  page.  Change  its  ID  to
                    IDC_THIN_Box1.
                   Choose the second edit box, and in the property page alter its ID to IDC_THICK_Box1
          2.   From the Controls toolbar, add two static text controls to enclose the descriptions for the
               two edit controls.
          3.   Choose the first text box to exhibit its property page. Modify the caption to Thin Pen Width:.
          4.   Choose the second text box, and in the property page change its caption to Thick Box1:.
          5.   From the Controls toolbar, add a third button to the two already present.
          6.   Choose  the  third  button  to  exhibit  its  property  page.  Transform  its  ID  to
               IDC_DEFAULT_Box1 and its caption to Default.



             Did u know?  The handler for this button will reset the thick and thin Box1 to their default
             widths.

          Self Assessment


          Fill in the blanks:
          12.  The Visual C++ environment offers a ......................... editor for designing dialog boxes.
          13.  You utilize the ......................... for every control to state its caption and ID.

          11.4 Using a Dialog Box

          Dialog boxes have several usage patterns:

          Question dialogs (using buttons) Ask users a single question, and provide simple responses in
          horizontally arranged command buttons.





















                                           LOVELY PROFESSIONAL UNIVERSITY                                   185
   186   187   188   189   190   191   192   193   194   195   196