CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Dynamic Editbox

  1. #1
    Join Date
    May 1999
    Posts
    19

    Dynamic Editbox

    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


  2. #2
    Join Date
    May 1999
    Location
    Republic of Korea
    Posts
    100

    Re: Dynamic Editbox

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured