There are some fascinating bugs involved in, say, editing a label in a tree control in a
property page, which require using a PreTranslateMessage handler.
In this code, the PreTranslateMessage handler checks for the ES_WANTRETURN style. In
fact, what it does is check the class of the window; only if it is an edit control is
anything ever checked. It also checks for the WM_GETDLGCODE returns from the control. So
it can be made robust, but a raw test just for VK_RETURN won't generalize.
joe
Post by AliRThe problem is that CPropertySheet inherits from CWnd and OnOK and OnCancel
are not implemented. Seems like CPropertySheet does something with
VK_RETURN in its winproc.
The one in CPropretyPage is really not needed. So if he ever wants to put a
multiline edit control in there all he has to do is get rid of the one in
CPropertyPage derived class.
AliR.
Post by Joseph M. NewcomerWhich will work until there is a multiline edit control in one of the
pages...
Post by Joseph M. NewcomerI would be inclined to add virtual methods OnOK and OnCancel and give them
empty bodies.
Post by Joseph M. Newcomerjoe
Post by AliRBut this seems to do the trick in my sample app
BOOL CSheet::PreTranslateMessage(MSG *pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
{
return TRUE;
}
return CPropertySheet::PreTranslateMessage(pMsg);
}
BOOL CPage::PreTranslateMessage(MSG *pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
{
return TRUE;
}
return CPropertyPage::PreTranslateMessage(pMsg);
}
AliR.
Post by k***@gmail.comI have a tab control with a property sheet for each tab control. When
switching between tabs the property sheets show and hide according to
which tab the user clicks on. Whenever I put the cursor in an edit box
and press enter, the property sheet goes blank.. anyone know of a good
solution for this?
Frank B.
Joseph M. Newcomer [MVP]
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: ***@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm