MSMASK - Programmer

This is a discussion on MSMASK - Programmer ; Hi, I am using an MSMASK edit control on a dialog. I need to trap a Tab event when the Focus is on this control. "Keydown" does not fire when the Tab key is pressed. "KeyPress" does not fire when ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: MSMASK

  1. MSMASK

    Hi,

    I am using an MSMASK edit control on a dialog.

    I need to trap a Tab event when the Focus is on this control.

    "Keydown" does not fire when the Tab key is pressed.
    "KeyPress" does not fire when the Tab key is pressed.
    "Keyup" fires on the edit control that receives Focus but not the one that
    the Tab event was initiated in ie the box losing focus !

    What do I need to do ! I would imagine I would be a able to trap a WM type
    message but it looks like I can only do this from within the Dialog. I was
    looking at something like a WM_CHAR but I cant get it to fire either.

    Any help much appreciated.

    Thanks.



  2. Re: MSMASK

    You shoud use the virtual PreTranslateMessage method to catch the
    "tab" key in your window.
    example:

    BOOL cYourWnd::PreTranslateMessage(MSG* pMsg)
    {
    if (pMsg->message == WM_KEYDOWN ){
    switch( pMsg->wParam ){
    case VK_RETURN: OnOk(); return TRUE;
    case VK_ESCAPE: OnCancel(); return TRUE;
    case VK_TAB: OnTab(); return TRUE;
    }
    }
    return CWnd::PreTranslateMessage(pMsg);
    }


    "Jonathan Bishop" wrote in message news:...
    > Hi,
    >
    > I am using an MSMASK edit control on a dialog.
    >
    > I need to trap a Tab event when the Focus is on this control.
    >
    > "Keydown" does not fire when the Tab key is pressed.
    > "KeyPress" does not fire when the Tab key is pressed.
    > "Keyup" fires on the edit control that receives Focus but not the one that
    > the Tab event was initiated in ie the box losing focus !
    >
    > What do I need to do ! I would imagine I would be a able to trap a WM type
    > message but it looks like I can only do this from within the Dialog. I was
    > looking at something like a WM_CHAR but I cant get it to fire either.
    >
    > Any help much appreciated.
    >
    > Thanks.


  3. Re: MSMASK

    You can use the virtual PreTranslateMessage method to catch this kind of message.

  4. Re: MSMASK

    Spot on BIP, just what I needed, Thanks !!



    "BIP" wrote in message
    news:3a2d202.0401230110.6e6f52e5@posting.google.co m...
    > You shoud use the virtual PreTranslateMessage method to catch the
    > "tab" key in your window.
    > example:
    >
    > BOOL cYourWnd::PreTranslateMessage(MSG* pMsg)
    > {
    > if (pMsg->message == WM_KEYDOWN ){
    > switch( pMsg->wParam ){
    > case VK_RETURN: OnOk(); return TRUE;
    > case VK_ESCAPE: OnCancel(); return TRUE;
    > case VK_TAB: OnTab(); return TRUE;
    > }
    > }
    > return CWnd::PreTranslateMessage(pMsg);
    > }
    >
    >
    > "Jonathan Bishop" wrote in message

    news:...
    > > Hi,
    > >
    > > I am using an MSMASK edit control on a dialog.
    > >
    > > I need to trap a Tab event when the Focus is on this control.
    > >
    > > "Keydown" does not fire when the Tab key is pressed.
    > > "KeyPress" does not fire when the Tab key is pressed.
    > > "Keyup" fires on the edit control that receives Focus but not the one

    that
    > > the Tab event was initiated in ie the box losing focus !
    > >
    > > What do I need to do ! I would imagine I would be a able to trap a WM

    type
    > > message but it looks like I can only do this from within the Dialog. I

    was
    > > looking at something like a WM_CHAR but I cant get it to fire either.
    > >
    > > Any help much appreciated.
    > >
    > > Thanks.




+ Reply to Thread