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?
|