Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - WM_KEYUP not handled in Property Grid Edits
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

WM_KEYUP not handled in Property Grid Edits

 Post Reply Post Reply
Author
Message
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Topic: WM_KEYUP not handled in Property Grid Edits
    Posted: 03 October 2008 at 11:58am
Hi Oleg/All,

I've a problem with Property Grid Edits:

If I type a number in a Property Grid Edit Item with the numeric keypad then both WM_KEYDOWN and WM_KEYUP are caught by the Edit and all is fine.

But if I type a number with the alphanumeric side of the keyboard (1/!, 2/@, 3/#, etc...) then only the WM_KEYDOWN is caught and the WM_KEYUP is still generated and then caught by my CWinApp::PreTranslateMessage(), which purposely generates some action that have the consequence of loosing the focus of the Edit box.

Is this a bug ? Or a intended feature ? And if yes can this be disabled ?

Thanks for shedding some lights here.

Best regards,

Dominique
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 06 October 2008 at 2:37am
Hi,
 
Have to be something in your code. PreTranslateMessage doesn't eat keys. Check what methods you override and what code can be reason.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 06 October 2008 at 5:04am
Hi Oleg,

Well, after deeper search it appears that there's indeed no difference between Alpha Numbers and Numpad Numbers...

... both generate a WM_KEYUP... and this is a problem for us as our Accelerators mechanism deals with KeyDown and KeyUp separately.

All our custom controls that should prevent Accelerators to be triggered do implement a PreTranslateMessage() like this:

/////////////////////////////////////////////////////////////////////////////
BOOL CItemEdit::PreTranslateMessage(MSG *pMsg)
{
     // To bypass ExAccelerators
     if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP)
     {
          TranslateMessage(pMsg);
          DispatchMessage(pMsg);
          return TRUE;
     }
     return CRichEditCtrl::PreTranslateMessage(pMsg);
}

This makes sure that when this Edit Box has the focus no WM_KEYDOWN AND WM_KEYUP are caught by the CWinApp::PreTranslateMessage().

Is there any way we can do the same in your code... without recompiling it or making a special version ?

At this point, this makes our app almost unusable...

Thanks for your help.

Dominique
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 06 October 2008 at 8:59am
Hi,
I still not sure what you have in your code and why it doesn't work for you, so can't suggest something :(
If you attach some sample that show prolem we will find some solution :)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 06 October 2008 at 10:17am
Hi Oleg,

It's quite simple, we have some code in CWinApp::PreTranslateMessage that triggers events for WM_KEYDOWN and WM_KEYUP.

These events should not be triggered when any Edit Box has the focus and for this any Edit Box should catch WM_KEYDOWN and WM_KEYUP. We do this by overriding PreTranslateMessage for all our Edit Box. (Please see the code in my previous post).

The problem is that Items in your PropertyGrid catch the WM_KEYDOWN but not the WM_KEYUP when typing in them so all WM_KEYUP are then caught by our CWinApp::PreTranslateMessage.

So the question is: Is there a way for your controls to catch WM_KEYUP as well, so we don't have to override all your controls PreTranslateMessage to do the same as our ?

Thanks in advance

Dominique
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 07 October 2008 at 2:37am
Don't you think its easy to change code of your PreTranslateMessage  than all Edit box that you can have ??
:)
 
Some hints:
 
TCHAR szClass[10];
  CWnd* pWndFocus = GetFocus();
  if (IsChild(pWndFocus) && GetClassName(pWndFocus->m_hWnd, szClass, 10) &&
   (lstrcmpi(szClass, _T("EDIT")) == 0))
  {
   return TRUE;
  }
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 07 October 2008 at 2:44am
Hi Oleg,

Thanks for the suggestion.

It wouldn't work for our controls as they're not all Edits, we have various other kind of windows, controls, popups, etc... that have to eventually catch the key messages (or not) depending their own status and context... that the main CWinApp::PreTranslateMessage() doesn't know anything about.

But that may work for you Edits. Are all items having key input in a property grid of class EDIT ?

Thanks again

Dominique
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 07 October 2008 at 9:54am
Yes.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.