No announcement yet.

Buttons & ENTER Key

  • Filter
  • Time
  • Show
Clear All
new posts

  • Buttons & ENTER Key

    I have a Name/Address/Phone List program with 15 Textboxes and 4 Buttons. The buttons respond correctly to mouse clicks and accelerator keys. But, if I use the tab key to move to the first button, or Shift Tab to move to the last button and then press the ENTER key, I do not get a consistant response. The first time the button responds correctly, the second time it does not. Am I missing or not handling a CBCTLMSG or does this require Sub Classing.

  • #2
    You might try an %IDOK in the callback to process the Enter key. Get
    the id of the button and then use sendmessage depending on your code.

    I know that doesn't answer your question but it might solve your situation.
    Last edited by Fred Buffington; 28 Mar 2009, 04:21 PM.
    Client Writeup for the CPA

    Links Page


    • #3
      <ENTER> sends WM COMMAND/IDOK, unelss there is a current default pushbutton, in which case it sends WM_COMMAND/that control.

      Easiest way to handle is to convert WM_COMMAND/IDOK to the control wth the focus:

              IF LOWRD(wParam) = %IDOK THEN 
                     PostMessage  GetFocus(), %BM_CLICK, %NULL, %NULL 
                     FUNCTION = 0 
                     EXIT FUNCTION
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]


      • #4
        Thanks. It bives me something to work with now.