Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. fire button when pressing enter in and edit box

fire button when pressing enter in and edit box

Scheduled Pinned Locked Moved C / C++ / MFC
questioncomhelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    r00k13
    wrote on last edited by
    #1

    hi, i have an edit box and a button add on a tab...im trying to have it where if a user press enter in the edit box it will execute the button add (call on the add function which the button is mapped to)..how can i do this? i've tried onchar event for that dialog and it's not detecting when i type in that edit box... one other thing, im using microsoft commondialog activex...how can i detect if the user press CANCEL or OK thanks alot for your help

    P A 2 Replies Last reply
    0
    • R r00k13

      hi, i have an edit box and a button add on a tab...im trying to have it where if a user press enter in the edit box it will execute the button add (call on the add function which the button is mapped to)..how can i do this? i've tried onchar event for that dialog and it's not detecting when i type in that edit box... one other thing, im using microsoft commondialog activex...how can i detect if the user press CANCEL or OK thanks alot for your help

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      Set the BS_DEFPUSHBUTTON style of the button.


      MSN Messenger. prakashnadar@msn.com "If history isn't good, just burn it." - Sidhuism.

      1 Reply Last reply
      0
      • R r00k13

        hi, i have an edit box and a button add on a tab...im trying to have it where if a user press enter in the edit box it will execute the button add (call on the add function which the button is mapped to)..how can i do this? i've tried onchar event for that dialog and it's not detecting when i type in that edit box... one other thing, im using microsoft commondialog activex...how can i detect if the user press CANCEL or OK thanks alot for your help

        A Offline
        A Offline
        avenger_sb25
        wrote on last edited by
        #3

        Make sure that the following propertty so not set for the edit box. ES_WANTRETURN Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiple-line edit control in a dialog box. Without this style, pressing the ENTER key has the same effect as pressing the dialog box’s default pushbutton. This style has no effect on a single-line edit control I hope it helps


        Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

        R 1 Reply Last reply
        0
        • A avenger_sb25

          Make sure that the following propertty so not set for the edit box. ES_WANTRETURN Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiple-line edit control in a dialog box. Without this style, pressing the ENTER key has the same effect as pressing the dialog box’s default pushbutton. This style has no effect on a single-line edit control I hope it helps


          Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

          R Offline
          R Offline
          r00k13
          wrote on last edited by
          #4

          the default button is already set on and want return for the edit box is not checked, still same problem, any other suggestions? thanks

          A 1 Reply Last reply
          0
          • R r00k13

            the default button is already set on and want return for the edit box is not checked, still same problem, any other suggestions? thanks

            A Offline
            A Offline
            avenger_sb25
            wrote on last edited by
            #5

            HI r00k13, i cant say for sure what is wrong but just try this. If it works, its gud 4 u. When u create a dialog box in the Dialog Editor, u r provided with two default buttons -OK & CNACEL. The proerty you are asking for is also present by default. (I have checked on my system, it is there even when u make a multiline edit box in the dialog). The OK button is clicked(OnIDOK() is called) when we press the "RETURN" key. It may be the case that you have deleted the default OK button and you have currently set a new button(that u hav created) as default. If it is so, change the ID if ur default Button from whatever it is currently, to IDOK. It may :cool: solve ur problem. Just giv it a try. Tell me if it works. ...Avenger


            Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups