NBKEY2.C

 /*--*\ * This procedure processes the keys sent to a dialog that implements the page of a    * * notebook control. Navigation keys are processed within the dialog page, all other   * * keys are forwarded to the frame window whose client area the notebook control is    * * part of. * * Req:                                                                                * *     hwndPage ...... Dialog implementing notebook page                              * *     hwndDialog .... Dialog where the notebook control is part of the client        * *     mp1 ........... Parameter 1 of WM_CHAR message sent to notebook page           * *     mp1 ........... Parameter 2 of WM_CHAR message sent to notebook page           * * Ret:                                                                                * *     ulRc .......... Return code: TRUE no error, FALSE otherwise                    * * Ref:                                                                                * \*--*/ MPARAM ProcessPageKey(HWND hwndPage, HWND hwndDialog, MPARAM mp1, MPARAM mp2) { #ifdef DEBUG_DIALOG printf("Dialog: Page - Got key (%02X)", (int)CHAR1FROMMP(mp2)); if (((CHAR1FROMMP(mp2))>=0x20) && ((CHAR1FROMMP(mp2))<0x7F)) printf("(%c)", (char)(SHORT1FROMMP(mp2))); printf("\n"); #endif /* DEBUG_DIALOG */

/* Process only the navigation keys in this dialog procedure, that implements a notebook dialog page. Forward all other keys to the dialog the notebook is part of the client */ if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) if ((SHORT2FROMMP(mp2)==VK_TAB)   ||       (SHORT2FROMMP(mp2)==VK_BACKTAB)||       (SHORT2FROMMP(mp2)==VK_LEFT)   ||       (SHORT2FROMMP(mp2)==VK_RIGHT)  ||       (SHORT2FROMMP(mp2)==VK_UP)     ||       (SHORT2FROMMP(mp2)==VK_DOWN)) { #ifdef DEBUG_DIALOG printf("Dialog: Page - is a navigation key\n"); #endif /* DEBUG_DIALOG */

/* Let the dialog page's window procedure handle the navigation keys (a break statement would just ignore the key the way this        dialog is implemented) */ return(WinDefDlgProc(hwndPage, WM_CHAR, mp1, mp2)); }

#ifdef DEBUG_DIALOG printf("Dialog: Page - not a navigation key\n"); #endif /* DEBUG_DIALOG */

/* See If the main dialog handled this keystroke */ if((BOOL)WinSendMsg(hwndDialog, WM_CHAR, mp1, mp2)) { #ifdef DEBUG_DIALOG printf("Dialog: Dialog - we handled it\n"); #endif /* DEBUG_DIALOG */ return((MRESULT)TRUE); }

#ifdef DEBUG_DIALOG printf("Dialog: Page - we handled it\n"); #endif /* DEBUG_DIALOG */

return((MRESULT)FALSE); } 