Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - CXTPPropertyGridInplaceList
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPPropertyGridInplaceList

 Post Reply Post Reply
Author
Message
Damian View Drop Down
Newbie
Newbie


Joined: 13 August 2014
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Damian Quote  Post ReplyReply Direct Link To This Post Topic: CXTPPropertyGridInplaceList
    Posted: 14 August 2014 at 12:27am
I'm using Xtreme ToolkitPro v16.2.0.  I've found a problem and was hoping someone could confirm whether or not there is a fix in a later version, or at all.

Here's the setup:

The main view of my application is a list view in report mode.  When you double click on a list view item, a property sheet is run.  Each property page has a property grid on it.

Some items in the various property grids have a list of strings in them, hence they have an in-place button that when clicked drops a list box down to display the strings to choose from.

There is an accelerator key bound to the enter key in the CWinApp derived object.

Here's the problem:

For a property grid item that has a list of strings, drop the list box down using the in-place button.  Next, use the up/down arrow keys to select a list box item.  Then tap the enter key -- the key press goes to the bound accelerator key, not the list box.

Interestingly, if you do not drop the list down, but instead just click the property grid item to set the focus, then use the up/down/enter key combo, the message is not routed the accelerator key.

Here's what debugging the Xtreme ToolkitPro revealed:

The edit box in a property grid item is an instance of CXTPPropertyGridInplaceEdit. The list box in a property grid item is an instance of CXTPPropertyGridInplaceList.

Both classes have a OnKeyDown method in their message maps. Both classes look for VK_RETURN and handle it appropriately.

The CXTPPropertyGridInplaceEdit class has a PreTranslateMessage override.
The CXTPPropertyGridInplaceList class does not have a PreTranslateMessage override.

If you just click the property grid item and do not drop down the list, a breakpoint in the CXTPPropertyGridInplaceEdit::OnKeyDown method reveals sure enough that up, down and enter key presses end up there.

However, if you put a breakpoint in the CXTPPropertyGridInplaceList::OnKeyDown method, the up and down key presses hit the breakpoint, but a press of the enter key does not. Instead, it ends up being routed to the accelerator key.

The reason appears to be the lack of a PreTranslateMessage override in the CXTPPropertyGridInplaceList class.

If you look at the guts of the AfxInternalPumpMessage method in MFC, then you can see that it calls AfxPreTranslateMessage.  This ends up walking the parent/child hierarchy of the inheritance tree looking for implementations of PreTranslateMessage. 

For the use case of enter being pressed in the CXTPPropertyGridInplaceEdit class, this works because CXTPPropertyGridInplaceEdit has as override that calls IsDialogMessage, which does the right thing.

For the use case of enter being pressed in the CXTPPropertyGridInplaceList class, there is no PreTranslateMessage override, so the work falls to the parent class CMDIFrameWnd, whose PreTranslateMessage calls TranslateAccelerator and hence the behaviour I'm seeing.

So I ask again, can someone confirm whether or not there is a fix in a later version of the Xtreme ToolkitPro, or at all?
Back to Top
Damian View Drop Down
Newbie
Newbie


Joined: 13 August 2014
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Damian Quote  Post ReplyReply Direct Link To This Post Posted: 14 August 2014 at 5:56pm
I modified the source code myself and rebuilt the libraries.  It works now.

Here's the fix for Xtreme ToolkitPro v16.2.0...

On line 100 of XTPPropertyGridInplaceList.h, add this:
BOOL PreTranslateMessage(MSG* pMsg);

In the file XTPPropertyGridInplaceList.cpp add this anywhere you like:
BOOL CXTPPropertyGridInplaceList::PreTranslateMessage(MSG* pMsg)
{
return (pMsg->message == WM_KEYDOWN && IsDialogMessage(pMsg));
}

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.156 seconds.