Enter key on dialog embedded in dialog not doing OnOK 
Author Message
 Enter key on dialog embedded in dialog not doing OnOK

I have a single-line Edit control and a Button.  I want the [enter] key,
while pressed during the entry of text inthe Edit box, to press the Button.
(The Button adds the contents of the Edit box to a List Box, clears the Edit
box, and puts focus back in the Edit box.).  By my controls are buried in
parent/child relationships.

In a "single-level" Dialog Box, I'd be able to us OnOK(), and IDOK as the
Button's ID. Or something like that.

But, my controls are on a Form View dialog that is classed as a CDialog (not
CFormView).  This dialog is Create()ed and Show()n in the OnInitDialog() of
a CPropertyPage.  The Property Page is Add()ed to a CPropertySheet that is
Create()ed and SetActive()ed in the OnInitDialog() of the main Dialog app.

I have tried using default button stuff (on the main Dialog and two-level
deep Dialog), catching OnSysCommand(), OnCommand() at both the main Dialog
and the deep Dialog, and so forth.  But, even with a default button on the
main dialog, all I get is a system alert beep (Ding!) when [enter] is
pressed while the user is typing in the Edit control.  The de{*filter*} shows
that none of my Event handlers are called when the [enter] key is pressed
(although they do get called for ordinary typing in the Edit box, moving the
window, uncovering the window, etc...).

Is there a good way to handle this?  I'm not even sure if I can get to the
KEYDOWN message at this point.

Thanks,
    - Dan



Mon, 12 Sep 2005 20:06:20 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. trapping the enter key in a dialog app

2. Enter key cause dialog app to exit

3. Enter Key behaviour in Dialog

4. Trapping ESC, ENTER key for dialogs

5. Dialog closes on Enter Key Down

6. Solved: Overriding Dialog behavior on ENTER ond ESC keys

7. Enter key on dialogs

8. Disabling Enter key on Dialog Based Application

9. Dialog closes on Enter Key Down

10. Enter Key on Dialogs...

11. ENTER and ESC keys in dialog based app

12. Enter or Escape keys exit dialog-based app

 

 
Powered by phpBB® Forum Software