Announcement

Collapse
No announcement yet.

draging out the old dog

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • draging out the old dog

    Hello,

    Sorry to bring this up again, but none of the previous suggestions on this BBS could help me out in this situation.

    I have a DDT form with NOTHING but labels on it. I need to catch the keystrokes (numbers 0-9, left and right, and then change the labels.

    I don't/can't have any controls with the focus set to them, so I can't subclass to catch the messages.

    I can't figure out how to use the keyboard accelerators in a DDT callback. Without using DDT everything is fine. The function TranslateAccelerator needs a tagMSG parameter, but the CBMSG keyword returns only the message part of the tagMSG. How do I get the full message tag in my callback?

    I'd be happy to use either keyboard accelerators or catch KEYDOWN messages as long as one of them would work! I don't like the idea of hidden controls... kind of patchy for my liking, but if it is the only way I guess that's what I have to do.

    Thanks,
    Colin Schmidt

    -------------
    Colin Schmidt & James Duffy, Praxis Enterprises, Canada

  • #2
    Hello,

    I didn't realize that Semen Matusovski example would work without the edit and combo controls. That fixes all my problems as long as R&D says that this is OK

    Why is this non-DDT message loop able to get the KEYDOWN messages, but the DDT callback is not?

    Any idea when we would know if this method is safe to use with DDT?

    Thanks,
    Colin Schmidt


    ------------------
    Colin Schmidt & James Duffy, Praxis Enterprises, Canada


    [This message has been edited by Colin Schmidt (edited February 23, 2000).]

    Comment


    • #3
      I've not had any "negative" feedback from R&D on this to date... if it works, I'd say it should be ok to use the technique, as long as DispatchMessage() is used to forward the messages to the DDT engine.

      If you encounter any problems that this technique appears to introduce, please post them so we can check into it.

      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        Hello,

        I did have to change the message loop to the following in order to prevent Windows from giving me a DING each time I pressed a key. This would have been happening only because I do not have any controls on my form that can hold the focus. So, I do not pass these messages on to DispatchMessage.

        BUT, if you did have controls on your form, as does Semen Matusovski example, then you will of course need to pass these on to DispatchMessage.

        The program does behave properly with this message loop and I have not come across any bugs.

        Code:
        DO WHILE GetMessage(Msg, %NULL, 0, 0)
                IF Msg.message = %WM_KEYDOWN THEN
                    HandleKey Msg.wParam
                ELSE
                    TranslateMessage Msg
                    DispatchMessage Msg
                END IF
                IF gMainDlgStop = %True THEN EXIT DO
        LOOP
        Thanks,
        Colin Schmidt


        [This message has been edited by Colin Schmidt (edited February 24, 2000).]

        Comment


        • #5
          ooooooops... I posted to an old thread I was referring to
          instead of the new thread I meant to reply to....

          [This message has been edited by Colin Schmidt (edited December 08, 2004).]

          Comment

          Working...
          X