Click to See Complete Forum and Search --> : Dynamic Editbox


rafiki
June 10th, 1999, 07:05 AM
I have a button in my Dialogbox.
when user hits this button I am creating dinamic editbox under this Button.
My purpose is to close this Editbox when the user is hits enter in this Editbox.
please tell me some WORKIN' method of how can i make it with easy...
thanx alot

Walter I An
June 10th, 1999, 09:26 PM
I am not sure whether this gonna work.
But suggest U to set Ur edit ctrl to ES_WANTRETURN
by editctrl.ModifyStyle(0,ES_WANTRETURN) after normal edit ctrl
creation. And then override Pretranslate function
in Ur dialog as following

//assume that Ur edit ctrl variable is class global
BOOL CYourDlg::PreTranslateMessage(MSG* pMsg)
{
if (editctrl.IsWindowVisible())
{
if ( pMsg->hwnd == editctrl.GetSafeHwnd() && pMsg->message == WM_KEYDOWN)
{
if (pMsg->wParam == VK_RETURN)
{
editctrl.ShowWindow(SW_HIDE);
return TRUE;
}
}

return CDialog::PreTranslateMessage(pMsg);
}

Hop for help. :)

Walter