Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CExtPopupControlMenuWnd: How to handle mouse and keyboard events Collapse All
Subject Author Date
Gregor Jasny Nov 5, 2007 - 9:12 AM

Hi,

I my project I need to create a popup bound to a toolbar button (like the color selector dialog).
Beside some buttons this popup must contain a CEdit-like control. IMHO this demand makes it impossible
to implement my popup the same way like the CExtPopupColorMenuWnd.

While reading through the source of the popups, I discovered the class CExtPopupControlMenuWnd.
In my overwritten OnCreateChildControl-method I’m creating a CExtResizableDialog, where I placed
all my buttons and the edit control with the ressource editor.

Beside some layout problems I’ve difficulties to forward the mouse and keyboard events to the dialog
(and the correct child control like button or edit).

My _OnKeyDown is the following, but it feels more like a hack:
bool CCSDialPad::_OnKeyDown(
    UINT nChar,
    UINT nRepCnt,
    UINT nFlags,
    bool & bNoEat
    )
{
    ASSERT_VALID( this );

    MSG _msg = {0};
    _msg.hwnd = ::GetFocus();
    _msg.wParam = WPARAM(nChar);
    _msg.lParam = MAKELPARAM(nRepCnt,nFlags);
    _msg.message =
        ( ( nFlags & (KF_UP) ) != 0 )
        ? WM_KEYUP
        : WM_KEYDOWN
        ;

    ::PostMessage(_msg.hwnd, _msg.message, _msg.wParam, _msg.lParam);

    return true;
}

While implementing _OnMouseMove and _OnMouseClick I got completely lost in the
depth of MFC and Prof-UIs black magic.

I’ve discovered the TranslateFooEventData_t classes, but they don’t seem to be useful for
my case.

It would be great if you could point me to some existing code or documentation or comment on this issue.

Thanks!
Gregor

Technical Support Nov 6, 2007 - 5:28 AM

The CExtPopupControlMenuWnd class is a base pop-up menu for custom menus with one child window only: a list box menu, a undo/redo menu and a date picker menu. Our pop-up menus never request focus and handle all the keyboard messages through thread wide hooks. The popup dialog like windows will work better if they request focus and all the controls will process their keyboard messages by default when they become focused. We think that in the toolbar you should use your own CExtBarButton-derived objects that implement the CExtBarButton::OnTrackPopup() virtual method and show simple non-modal dialogs without caption instead of a pop-up menu.