
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