CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 1999
    Location
    St. Louis
    Posts
    45

    Return key press in Dialogs

    Hello,
    I am having just the opposite problem as "Dialog Focus Blues." Two dialogs in my application have desired behaviors switched and I do not know why.

    The first is a login dialog. It has default styled button, a list box (users) and a password field. I would like the return key to simulate a click in the default button.

    The second is a setup dialog. This dialog contains sub-CDialogs. The return key dismisses the parent dialog unless the control style is set true on the sub-dialogs and I have not switched which sub-dialog is visible.

    Both dialogs have identical style attributes.

    I believe ::IsDialogMessage is trapping and altering the return key message in the one dialog. What piece of logic do I not understand?

    Thank you
    Dave Giovannini



  2. #2
    Join Date
    Apr 1999
    Posts
    306

    Re: Return key press in Dialogs

    For the first case override the OnOK() fucntion like this:

    void CMyDialog::OnOK()
    {
    OnClickedDefaultButton();
    }

    For the second:

    I do not understand very well the problem.


  3. #3
    Join Date
    Mar 1999
    Location
    St. Louis
    Posts
    45

    Re: Return key press in Dialogs

    I found that the following conditions needed to be met for the return/esc keys to work in my login dlg.

    The buttons must have IDs IDOK and IDCANCEL. The IDOK button cannot be remapped to another method. This is probably why OnOK is virtual.

    As far as the other problem. The odd thing is there is no default button an ony of the dialogs. I guess I can just override OnOK and have do nothing.


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