Page 204 - DCAP408_WEB_PROGRAMMING
P. 204

Windows Programming




                    Notes
                                          Example: When your ‘small’ program grows into a very large one, it can also simplify
                                   more immediate problems such as testing the code or making it work correctly in a concurrent
                                   environment.

                                   Self Assessment

                                   Fill in the blanks:

                                   6.  A global variable can be get or set by any part of the program, and any .........................
                                       regarding its use can be easily broken or forgotten.
                                   7.  If globals can be accessed by multiple threads of execution, ......................... is necessary
                                       (and too-often neglected).
                                   8.  When dynamically linking modules, it can be unclear whether  different libraries have
                                       their own ......................... of globals or whether the globals are shared.
                                   12.3 Exchanging Data with a Dialog Box – Pointer Method


                                   Dialog Box Data Exchange and Validation


                                   The controls in a dialog box are specialized windows that store their own copy of the data that
                                   the user enters or changes. In the lifetime of a dialog box, you'll normally want to initialize
                                   these controls with data from your program, and then save that data back into those variables.
                                   You'll probably also want to validate the values stored in the controls to ensure that they are
                                   within acceptable ranges when the user attempts to click OK to exit the dialog box.

                                   Obviously, the first task  in this  process is to add  new member  variables to  the dialog  box
                                   handler class that correspond to the controls.

                                   Mapping Member Variables to Controls

                                   You can use ClassWizard to add member variables and provide the mapping for most of the
                                   dialog box controls via ClassWizard's Member Variables tab (see Figure 12.1).

                                                    Figure  12.1:  The ClassWizard  Member  Variables  Tab



























          198                               LOVELY PROFESSIONAL UNIVERSITY
   199   200   201   202   203   204   205   206   207   208   209