Announcement

Collapse
No announcement yet.

Buttons & ENTER Key

Collapse
X
 
  • 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, 03:21 PM.
    Client Writeup for the CPA

    buffs.proboards2.com

    Links Page

    Comment


    • #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:

      Code:
         CASE %WM_COMMAND
              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]
      http://www.talsystems.com

      Comment


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

        Comment

        Working...
        X