Click to See Complete Forum and Search --> : edit control in a propertypage
veesub
May 5th, 1999, 12:31 AM
The problem is as follows:
I'm using a edit control in a propertypage. When I press enter within the edit control I would like to activate a push button in the same propertypage. i.e., when the user presses enter after typing the data in the edit control some pushbutton has to be activated by default.Any suggestions?
eric33
May 5th, 1999, 01:57 AM
A solution could be to override the PretranslateMessage of the CPropertySheet class.
Then in this function you verify if it is a ENTER key pressed message. To avoid the message to be sent to the default button just return TRUE.
BOOL CMyClass::PreTranslateMessage(MSG* pMsg)
{
if ( pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN && GetFocus()==&m_mytextbox )
{
//...
return TRUE;
}
return CPropertySheet::PreTranslateMessage(pMsg);
}
I hope this method could help.
BrianOG
May 5th, 1999, 02:10 AM
I've had to resort to this also.
I tried SetFocus(), SetActiveWindow(), SetForegroundWindow(), and even tried modifying styles of buttons to be DEFPUSHBUTTON, but the wizard keeps changing focus.
eric33
May 5th, 1999, 02:52 AM
I do not understand. I try the solution I purposes and it works.
Is your problem to disable the default button on pressing ENTER key ?
If yes i try the following code when mypage has the focus and when user press ENTER key then the default button is not used because the message is not dispatched (return TRUE).
BOOL CMySheet::PreTranslateMessage(MSG* pMsg)
{
if ( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN )
if ( GetActivePage() == &MyPage )
return TRUE;
return CPropertySheet::PreTranslateMessage
(pMsg);
}
If your problem is another one then explain it more precisely.
veesub
May 5th, 1999, 04:47 AM
Thank you eric
that is what my problem is and solved it through your idea. Thank You for your information
bye from Subramanian
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.