Jump to content

NBKEY1.C

From EDM2
Revision as of 00:59, 20 December 2017 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
/*--------------------------------------------------------------------------------------*\
 * This window procedure is a subclass procedure of a notebook, to support pressing     *
 * accelerator keys within a notebook page, the notebook itself and the dialog the      *
 * notebook is part of the client. Without this subclassing the notebook would not      *
 * forward keys it is not interested in to its owner (the dialog), but the owner would  *
 * probably be interested in such keys.                                                 *
\*--------------------------------------------------------------------------------------*/
MRESULT  EXPENTRY SubclassedNotebookProcedure(HWND hwndNotebook, ULONG msg, MPARAM mp1, MPARAM mp2)
{
ULONG   ulIndex;

for(ulIndex=0; ulIndex<NOTEBOOKSUBCLASSMAX; ulIndex++)
    {
    if(DialogNotebookSubclass[ulIndex].hwndNotebook==hwndNotebook)
        {
        if(msg==WM_CHAR)
            {
             /* We are only interested in WM_CHAR messages as a
                result of keystrokes the notebook is willing to accept.
                We CALL the window procdure to receive the evaluation,
                as we have to pass on to the owner what the notebook
                ignores e.g. ALT+C for the Cancel pushbutton (the notebook
                should do this itself but doesn't) */
            if(!(BOOL)(DialogNotebookSubclass[ulIndex].pfnwpNotebook)(hwndNotebook, msg, mp1, mp2))
                {
#ifdef  DEBUG_DIALOG
                printf("Dialog: Notebook - forwarding to dialog\n");
#endif  /* DEBUG_DIALOG */
                return(WinSendMsg(WinQueryWindow(hwndNotebook, QW_OWNER), msg, mp1, mp2));
                }
            else
                break;
            }
        else
            {
                /* All messages but WM_CHAR are routed to the window
                   procedure before subclassing */
            return((DialogNotebookSubclass[ulIndex].pfnwpNotebook)(hwndNotebook, msg, mp1, mp2));
            }
        }
    }
return((MRESULT)TRUE);
}