Capturing return in dialog

This is a discussion on Capturing return in dialog within the Windows Programming forums, part of the Platform Specific Boards category; I have a dialog box generated by a CPropertySheet, and a CPropertyPage with an edit control and a button. The ...

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    Capturing return in dialog

    I have a dialog box generated by a CPropertySheet, and a CPropertyPage with an edit control and a button. The page may have multiple instances in the sheet. When the focus is on the edit control, I want a CR to activate the button. The other threads on this topic that I found didn't really solve my problem, and I have tried many different techniques without success.

    So, how do I make the edit control send its CRs to a particular control?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607
    Have you tried making the button the default button of the dialog? Is the edit control multi-lined?

    gg

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I tried all of that. Eventually I settled for the following solution.

    1. In OnInitDialog(), I dynamically allocate a CEdit instance, and use it to call SubclassDlgItem(), directing messages to the parent dialog box.

    2. In CDialog::PreTranslateMessage() I check for enter key presses.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607
    Nice.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I make this code more elegant?
    By ejohns85 in forum C++ Programming
    Replies: 3
    Last Post: 04-02-2009, 08:55 AM
  2. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  3. make Child Dialog not Popup?
    By Zeusbwr in forum Windows Programming
    Replies: 5
    Last Post: 04-08-2005, 02:42 PM
  4. opengl help
    By heat511 in forum Game Programming
    Replies: 4
    Last Post: 04-05-2004, 01:08 AM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21