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. Form view problem

Form view problem

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 Posts 2 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
    Raghunandan S
    wrote on last edited by
    #1

    Hi All, I have a FormView application,which contains some edit boxes ,combo boxes,two radio buttons(radio1 and radio2)and two buttons(button1(IDOK) and button2(IDC_BUTTON_XXX)). the two buttons have BN_CLICKED handler functions. when i select radio1, button1 will be shown to the user and button2 will be hidden. select radio2 ,button2 will be shown to the user and button1 will be hidden. my problem is that in radio2 selection,i input data in the edit boxes press ENTER key,button1's BN_CLICKED handler function getting invoked instead of button2's handler. Can anyone tell me what might be the possible reason. Thanks in Advance..

    A 1 Reply Last reply
    0
    • R Raghunandan S

      Hi All, I have a FormView application,which contains some edit boxes ,combo boxes,two radio buttons(radio1 and radio2)and two buttons(button1(IDOK) and button2(IDC_BUTTON_XXX)). the two buttons have BN_CLICKED handler functions. when i select radio1, button1 will be shown to the user and button2 will be hidden. select radio2 ,button2 will be shown to the user and button1 will be hidden. my problem is that in radio2 selection,i input data in the edit boxes press ENTER key,button1's BN_CLICKED handler function getting invoked instead of button2's handler. Can anyone tell me what might be the possible reason. Thanks in Advance..

      A Offline
      A Offline
      Antti Keskinen
      wrote on last edited by
      #2

      This is caused by the form view's default implementation. A click on the Enter key issues a command for the form to simulate a click on it's default button, which usually is the 'OK' button. In your case, it is the button 1. To remedy this, change the button 2 to be the default button of the form, or alternatively, capture keyboard messages sent to the form and filter out those containing VK_RETURN. This prevents the form from calling the default button's BN_CLICKED handler when it receives a key press event indicating the Enter/Return key was pressed. Of course, when you filter out the keyboard messages, you can custom-call the click handler for the second button as well. To simulate a click on a button, create a WM_COMMAND message, put the HIWORD of wParam to be 'BN_CLICKED' and LOWORD to be the ID of the control. The lParam can be left alone (NULL) or can be the window handle (HWND) of the control. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.

      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