示例#1
0
MRESULT wxButton::WindowProc(
  WXUINT                            uMsg
, WXWPARAM                          wParam
, WXLPARAM                          lParam
)
{
    //
    // When we receive focus, we want to temporary become the default button in
    // our parent panel so that pressing "Enter" would activate us -- and when
    // losing it we should restore the previous default button as well
    //
    if (uMsg == WM_SETFOCUS)
    {
        if (SHORT1FROMMP(lParam) == TRUE)
            SetTmpDefault();
        else
            UnsetTmpDefault();

        //
        // Let the default processign take place too
        //
    }

    else if (uMsg == WM_BUTTON1DBLCLK)
    {
        //
        // Emulate a click event to force an owner-drawn button to change its
        // appearance - without this, it won't do it
        //
        (void)wxControl::OS2WindowProc( WM_BUTTON1DOWN
                                       ,wParam
                                       ,lParam
                                      );

        //
        // And conitnue with processing the message normally as well
        //
    }

    //
    // Let the base class do all real processing
    //
    return (wxControl::OS2WindowProc( uMsg
                                     ,wParam
                                     ,lParam
                                    ));
} // end of wxWindowProc
示例#2
0
WXLRESULT wxButton::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
    // when we receive focus, we want to temporarily become the default button in
    // our parent panel so that pressing "Enter" would activate us -- and when
    // losing it we should restore the previous default button as well
    if ( nMsg == WM_SETFOCUS )
    {
        SetTmpDefault();

        // let the default processing take place too
    }
    else if ( nMsg == WM_KILLFOCUS )
    {
        UnsetTmpDefault();
    }

    // let the base class do all real processing
    return wxAnyButton::MSWWindowProc(nMsg, wParam, lParam);
}