Page 128 - DCAP408_WEB_PROGRAMMING
P. 128

Windows Programming




                    Notes          When the user uses an accelerator that corresponds to a  menu item, the window procedure
                                   receives the WM_INITMENU and WM_INITMENUPOPUP messages as though the user had
                                   selected the menu item. For information about how to process these messages, see Menus.
                                   An accelerator that corresponds to a menu item should be included in the text of the menu item.

                                   7.11.5 UI  State

                                   Windows enables applications to hide or show various features in  its UI. These settings are
                                   known as the UI state. The UI state includes the following settings:

                                      focus indicators (such as focus rectangles on buttons)
                                      keyboard accelerators (indicated by underlines in control labels)
                                   A window can send messages to request a change in the UI state, can query the UI state, or
                                   enforce a certain state for its child windows. These messages are as follows.
                                   MessageDescription
                                   WM_CHANGEUISTATE Indicates that the UI state should change.

                                   WM_QUERYUISTATE      Retrieves the UI state for a window.
                                   WM_UPDATEUISTATE     Changes the UI state.
                                   By default, all child windows of a top-level window are created with the same UI state as their
                                   parent.
                                   The system handles the UI state for controls in dialog boxes. At dialog box creation, the system
                                   initializes the UI state accordingly. All child controls inherit this state. After the dialog box is
                                   created, the system monitors the user's keystrokes. If the UI state settings are hidden and the
                                   user navigates using the keyboard, the system updates the UI state. For example, if the user
                                   presses the Tab key to move the focus to the next control, the system calls WM_CHANGEUISTATE
                                   to  make  the  focus  indicators  visible.  If  the  user  presses  the  Alt  key,  the  system  calls
                                   WM_CHANGEUISTATE to make the keyboard accelerators visible.
                                   If a control supports navigation between the UI elements it contains, it can update its own UI
                                   state. The control can call WM_QUERYUISTATE to retrieve and cache the initial UI state. Whenever
                                   the control receives an WM_UPDATEUISTATE message, it can update its UI state and send a
                                   WM_CHANGEUISTATE message to its parent. Each window will continue to send the message
                                   to  its  parent  until  it  reaches  the  top-level  window.  The  top-level  window  sends  the
                                   WM_UPDATEUISTATE message to the windows in the window tree. If a window does not pass
                                   on the WM_CHANGEUISTATE message, it will not reach the top-level window and the UI state
                                   will not be updated.
                                   Self Assessment


                                   Fill in the blanks:
                                   15.  An ......................... table includes an array of ACCEL structures, each defining an individual
                                       accelerator.
                                   16.  The WM_COMMAND message comprises the identifier of the accelerator that caused
                                       ......................... to produce the message.









          122                               LOVELY PROFESSIONAL UNIVERSITY
   123   124   125   126   127   128   129   130   131   132   133