Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
hey all, trying to get keydown of Carriage Return, but instead i'm getting IDOK, which is bad

Respondida hey all, trying to get keydown of Carriage Return, but instead i'm getting IDOK, which is bad

  • miércoles, 07 de marzo de 2012 1:49
     
     

    because i have several controls, that i get this message.

    i have a form, with 2 combo box,

    i subclass, both, each to each wndproc,

    and everything works fine, until the user press, CR,

    i don't get any WM_KEYDOWN , on this press,

    instead i get IDOK.

    i have 2 questions:

    1. is there an identifier with the IDOK ?

    2. more important to me, is how to avoid the IDOK,

    and get the KEYDOWN.

    i want to remind, that the internal edit control, in the combo box,

    is single line, so maybe that causes the problem,

    but how to avoid this ?

    thank you very much in advanced.

Todas las respuestas

  • miércoles, 07 de marzo de 2012 4:42
     
     Respondida Tiene código

    Try handling WM_GETDLGCODE message in your subclassed wndproc, and return DLGC_WANTALLKEYS.

    case WM_GETDLGCODE:
        return DLGC_WANTALLKEYS ;

    Then your comboboxes should get keydown messages for Return key.

  • miércoles, 07 de marzo de 2012 21:18
     
     Respondida

    thank you very much, this helped,

    but now i'm getting new problem,

    each time i press CR, i get a beep.

    i tried several things:

      1.changing the wparam, and send it forward.

      2.don't send forward the keydown message, when CR arrived.

    but no success.

    any help on this ?

    thanks in advanced

  • jueves, 08 de marzo de 2012 2:03
     
     

    ok, i solved it by handling the WM_CHAR

    thank you very very much for you help, and the link you supplied that was very helpfull.

  • jueves, 08 de marzo de 2012 2:10
     
     
    So Pierre gives you the answer and you mark your comment as the accepted answer?  Very rude of you, to be honest.  Give credit to whomever deserves it.

    Jose R. MCP

  • jueves, 08 de marzo de 2012 2:42
     
     

    oh i'm very sorry man,

    i just searched for the place to mark this post as solved,

    even now i don't know,

    but ofcourse i will mark his post.

    thanks for your reply also.