Re: I want to press Enter in CEdit box and have a function be called



You could put in an OnOK() function in your dialog and keep track of which
control has the focus when the Enter is pressed. Then you could do whatever
you want and continue the dialog. Of course, this will take away a standard
functionality of a dialog (clicking default button when user presses Enter),
but lots of people do this sort of thing.

Tom

"Marek" <marek.krzeminski@xxxxxxxxx> wrote in message
news:1150314805.078233.152410@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have created a dialog based application that has three edit fields.

I want to be able to call a function when the user presses Enter in any
of the edit boxes. For instance, when user presses Enter in edit box
1, I want to call Function1(). When user presses Enter in edit box 2,
I want to call Function2().

How do I do this?

I can't use ON_EN_UPDATE because the function that I am calling takes a
long time to process. If I use OnUpdate then for every letter the user
types, my function will run.

I don't want to use ON_EN_KILLFOCUS because I want the user to see the
results of my function after they press Enter. I don't want them to
have to go an press another button or do something else to see the
results.

Can anyone help me?



.



Relevant Pages

  • Re: Dialog shall not end on RETURN
    ... If one then presses ENTER the application quits. ... set to the only Edit Control window the application is quit as well. ...
    (microsoft.public.vc.mfc)
  • Re: JOptionPane returning Object?
    ... be returned when the user presses the "ok" ... >> JFrame, that returns the object? ... >> the JOptionPane. ...
    (comp.lang.java.help)
  • KeyPreview doesnt trap Enter key
    ... I need a form to take a certain action when the user presses the Enter key. ... I set KeyPreview to True at design time and never change it. ... Focus is on a control other than a command button, ...
    (microsoft.public.vb.bugs)
  • Re: FORM with buttons
    ... I have a simple form with three buttons in a horizontal row. ... to have focus when the form opens, such that if the user simply presses ... and gets executed if user presses 'Return' (if they don't click ... tag), so it's probably just an option or attribute ...
    (alt.html)
  • Re: FORM with buttons
    ... richard wrote: ... I have a simple form with three buttons in a horizontal row. ... to have focus when the form opens, such that if the user simply presses ... and gets executed if user presses 'Return' (if they don't click ...
    (alt.html)