Announcement

Collapse
No announcement yet.

Trapping mouse clicks and keyboard keys

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

  • Trapping mouse clicks and keyboard keys

    This is probably a very simple question but one that is giving
    me a heck of problem. I am writing a MDI text editor and cannot
    trap the %WM_LBUTTONDOWN in my EditProc function.

    Everything I've read up to this point says the mouse clicks are sent to the window beneath the cursor. Well that means I'm clicking in the edit control window of the child window whos parent is the MDI client. The message should be going (I think) to the EditProc function.

    I've tried trapping the messages in the FrameProc function but no luck so far. What gives here? I know the mouse clicks are going somewhere because right click brings up the default "popup" menu inside the multi-line edit window.

    TIA,
    Cecil

  • #2
    Cecil,

    Without any code samples how are we to know what you are doing wrong in your code?

    You'll get a much better response if you post some actual code we can try.

    --Dave


    ------------------
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Home of the BASIC Gurus
    www.basicguru.com

    Comment


    • #3
      The right click popup menu is built into the edit control not the MDI class. Post your subclassed edit procedure for now.

      You may need to register your child window(childWinProc) and
      trap it inside that funciton. My guess is that your edit control
      is parented by the child window ??

      Regards, Jules




      [This message has been edited by Jules Marchildon (edited February 24, 2000).]
      Best regards
      Jules
      www.rpmarchildon.com

      Comment


      • #4
        Jules,

        I think you may have hit on the answer. Yes, the right click is
        in an edit control, and yes the edit control is a child
        on the MDI class window.

        Question arises now is "Does the edit control window need to be
        subclassed to the MDI child where EditProc is called?" This is probably correct. My thinking was that the edit control talked directly to it's parent, but maybe not.

        Dave, you are right but I thought this would be a simple "You just screwed up here dude". I'll try the subclass next week.

        Thanx guys,
        Cecil

        ------------------

        Comment


        • #5
          Try "eating" the message for the default popupmenu. I use the
          following successfully in a subclassed MDI richedit control (a
          stripped-down version of it):

          Code:
          FUNCTION TextWndProc(BYVAL hWnd AS LONG, BYVAL wMsg AS LONG, _
                               BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
            LOCAL  pMen AS POINTAPI
           
            SELECT CASE wMsg
              CASE %WM_COMMAND
                SELECT CASE LOWRD(wParam)
                  'To catch and pass on selections made in my popupmenu
                  CASE %IDM_UNDO, %IDM_CUT, %IDM_COPY, %IDM_PASTE, %IDM_DELETE, _
                       %IDM_SELALL, %IDM_FIND, %IDM_FINDNEXT, %IDM_REPLACE, %IDM_DOCINFO
                    WndProc hWnd, wMsg, wParam, lParam
                END SELECT
           
              CASE %WM_CONTEXTMENU
                '"Eat" the message for the crappy little default popupmenu
                FUNCTION = 0: EXIT FUNCTION
           
              'CASE %WM_INITMENUPOPUP 'works fine
              'CASE %WM_KEYDOWN       'works fine
              'CASE %WM_KEYUP         'works fine
              'CASE %WM_MOUSEMOVE     'works fine
           
              CASE %WM_RBUTTONDOWN
                pMen.x = LOWRD(lParam)
                pMen.y = HIWRD(lParam)
                CALL ClientToScreen (hWnd, pMen) 'Get Mouse position
                CALL TrackPopupMenu (MnuEdit, 0, pMen.x, pMen.y, 0, hWnd, BYVAL %NULL)
           
            END SELECT
            TextWndProc = CallWindowProc(OldProc, hWnd, wMsg, wParam, lParam)
           
          END FUNCTION

          ------------------




          [This message has been edited by Borje Hagsten (edited February 24, 2000).]

          Comment

          Working...
          X