Results 1 to 8 of 8

Thread: Form closing when i press enter key?

  1. #1

    Thread Starter
    Addicted Member FOOBAR's Avatar
    Join Date
    Aug 2000
    Posts
    172

    Form closing when i press enter key?

    WHY DO MY PROGRAMS CLOSE WHEN I PRESS ENTER?
    AND HOW DO STOP THIS?
    No Comment.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Erm, they won't unless your window procedure handles things like this. Are you using MFC?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Addicted Member FOOBAR's Avatar
    Join Date
    Aug 2000
    Posts
    172
    yes MFC
    No Comment.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Override OnOK, or remove the OK button. In the same way, pressing escape triggers OnCancel (I think).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5

    Thread Starter
    Addicted Member FOOBAR's Avatar
    Join Date
    Aug 2000
    Posts
    172
    a lot of program that people i konw have that problem...my friend has that problem, and this program called PunkBuster for the online game half-life does it.....

    can i just make the keypress event do somthing else? how would i do that?
    No Comment.

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    With MFC, if you want to change the default behaviour, just override the methods in your dialogue box class.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7

    Thread Starter
    Addicted Member FOOBAR's Avatar
    Join Date
    Aug 2000
    Posts
    172
    still cant figure it out...i deleted the ok and cancel buttons, and no where in any of my code is OnOK(); or OnCancel();

    but it still closes when i press enter
    No Comment.

  8. #8
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    That's because you need to override OnOK and OnCancel using ClassWizard.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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