Loading ...
Sorry, an error occurred while loading the content.

Capture Mouse on Status Bar

Expand Messages
  • Peter Carlson
    Standard WTL appp, SDI. Multipane status bar. I want to activate a feature of the software if a user clicks in a certain pane of the status bar, lets say
    Message 1 of 5 , Feb 1, 2005
    View Source
    • 0 Attachment
      Standard WTL appp, SDI. Multipane status bar. I want to activate a
      feature of the software if a user clicks in a certain pane of the status
      bar, lets say pane 3. As long as the mouse is down the feature is
      active even if they move the mouse (Means I need to SetCapture()) and
      then when they release it returns to normal.

      I can handle WM_PARENTNOTIFY for WM_LBUTTONDOWN, but where does the
      WM_LBUTTONUP come from? Any ideas on how best to handle this? Do I
      need to subclass the status bar?

      Peter
    • Roger Headrick
      ... a ... status ... and ... I ... If you capture the mouse with the status bar s HWND, NM_CLICK should work. -Roger
      Message 2 of 5 , Feb 2, 2005
      View Source
      • 0 Attachment
        --- In wtl@yahoogroups.com, "Peter Carlson" <peter@h...> wrote:
        > Standard WTL appp, SDI. Multipane status bar. I want to activate
        a
        > feature of the software if a user clicks in a certain pane of the
        status
        > bar, lets say pane 3. As long as the mouse is down the feature is
        > active even if they move the mouse (Means I need to SetCapture())
        and
        > then when they release it returns to normal.
        >
        > I can handle WM_PARENTNOTIFY for WM_LBUTTONDOWN, but where does the
        > WM_LBUTTONUP come from? Any ideas on how best to handle this? Do
        I
        > need to subclass the status bar?
        >
        > Peter

        If you capture the mouse with the status bar's HWND, NM_CLICK should
        work.

        -Roger
      • Peter Carlson
        NM_CLICK wont work as I need to do something like this: CMainFrame::OnParentNotify(...) { if (wParam == WM_LBUTTONDOWN) if (PANE == 2) SetCpature();
        Message 3 of 5 , Feb 2, 2005
        View Source
        • 0 Attachment
          NM_CLICK wont work as I need to do something like this:

          CMainFrame::OnParentNotify(...) {
          if (wParam == WM_LBUTTONDOWN)
          if (PANE == 2)
          SetCpature();
          m_ExtendedStatusWindow.ShowWindow(SW_SHOW);
          }

          OnLButtonUp(...) {
          if (m_ExtendedStatusWindow.IsVisible())
          m_ExtendedStatusWindow.ShowWindow(SW_HIDE);
          ReleaseCapture();
          }

          But my questions are:
          1. where can I get the LBUTTONUP message? To release the capture and
          hide the status window
          2. How can I convert the x/y I get in the ParentNotify to a status
          pane?

          Peter

          -----Original Message-----
          From: Roger Headrick [mailto:lilsroro@...]
          Sent: Wednesday, February 02, 2005 4:43 AM
          To: wtl@yahoogroups.com
          Subject: [wtl] Re: Capture Mouse on Status Bar



          --- In wtl@yahoogroups.com, "Peter Carlson" <peter@h...> wrote:
          > Standard WTL appp, SDI. Multipane status bar. I want to activate
          a
          > feature of the software if a user clicks in a certain pane of the
          status
          > bar, lets say pane 3. As long as the mouse is down the feature is
          > active even if they move the mouse (Means I need to SetCapture())
          and
          > then when they release it returns to normal.
          >
          > I can handle WM_PARENTNOTIFY for WM_LBUTTONDOWN, but where does the
          > WM_LBUTTONUP come from? Any ideas on how best to handle this? Do
          I
          > need to subclass the status bar?
          >
          > Peter

          If you capture the mouse with the status bar's HWND, NM_CLICK should
          work.

          -Roger





          [Non-text portions of this message have been removed]
        • pablo_alch
          See http://www.codeproject.com/wtl/MultiPaneStatusBarEx.asp The classes there let you put just about anything on top of a status bar pane. In your case, a
          Message 4 of 5 , Feb 2, 2005
          View Source
          • 0 Attachment
            See http://www.codeproject.com/wtl/MultiPaneStatusBarEx.asp

            The classes there let you put just about anything on top of a status
            bar pane. In your case, a modeless dialog (there is an example of
            that in the article), which sends (WM_APP + n) messages to your main
            frame window, could be a solution. Another solution could be a simple
            CButton, if relevant.

            Hope this helps,

            Pablo.


            --- In wtl@yahoogroups.com, "Peter Carlson" <peter@h...> wrote:
            > NM_CLICK wont work as I need to do something like this:
            >
            > CMainFrame::OnParentNotify(...) {
            > if (wParam == WM_LBUTTONDOWN)
            > if (PANE == 2)
            > SetCpature();
            > m_ExtendedStatusWindow.ShowWindow(SW_SHOW);
            > }
            >
            > OnLButtonUp(...) {
            > if (m_ExtendedStatusWindow.IsVisible())
            > m_ExtendedStatusWindow.ShowWindow(SW_HIDE);
            > ReleaseCapture();
            > }
            >
            > But my questions are:
            > 1. where can I get the LBUTTONUP message? To release the capture
            and
            > hide the status window
            > 2. How can I convert the x/y I get in the ParentNotify to a status
            > pane?
            >
            > Peter
            >
            > -----Original Message-----
            > From: Roger Headrick [mailto:lilsroro@y...]
            > Sent: Wednesday, February 02, 2005 4:43 AM
            > To: wtl@yahoogroups.com
            > Subject: [wtl] Re: Capture Mouse on Status Bar
            >
            >
            >
            > --- In wtl@yahoogroups.com, "Peter Carlson" <peter@h...> wrote:
            > > Standard WTL appp, SDI. Multipane status bar. I want to
            activate
            > a
            > > feature of the software if a user clicks in a certain pane of the
            > status
            > > bar, lets say pane 3. As long as the mouse is down the feature is
            > > active even if they move the mouse (Means I need to SetCapture())
            > and
            > > then when they release it returns to normal.
            > >
            > > I can handle WM_PARENTNOTIFY for WM_LBUTTONDOWN, but where does
            the
            > > WM_LBUTTONUP come from? Any ideas on how best to handle this?
            Do
            > I
            > > need to subclass the status bar?
            > >
            > > Peter
            >
            > If you capture the mouse with the status bar's HWND, NM_CLICK
            should
            > work.
            >
            > -Roger
            >
            >
            >
            >
            >
            > [Non-text portions of this message have been removed]
          • Roger Headrick
            ... and ... Since the mainframe captured the mouse, the mainframe will get a WM_LBUTTONUP message when the button is released. ... WM_PARENTNOTIFY s lParam
            Message 5 of 5 , Feb 2, 2005
            View Source
            • 0 Attachment
              --- In wtl@yahoogroups.com, "Peter Carlson" <peter@h...> wrote:
              > NM_CLICK wont work as I need to do something like this:
              >
              > CMainFrame::OnParentNotify(...) {
              > if (wParam == WM_LBUTTONDOWN)
              > if (PANE == 2)
              > SetCpature();
              > m_ExtendedStatusWindow.ShowWindow(SW_SHOW);
              > }
              >
              > OnLButtonUp(...) {
              > if (m_ExtendedStatusWindow.IsVisible())
              > m_ExtendedStatusWindow.ShowWindow(SW_HIDE);
              > ReleaseCapture();
              > }
              >
              > But my questions are:
              > 1. where can I get the LBUTTONUP message? To release the capture
              and
              > hide the status window

              Since the mainframe captured the mouse, the mainframe will get a
              WM_LBUTTONUP message when the button is released.

              > 2. How can I convert the x/y I get in the ParentNotify to a status
              > pane?

              WM_PARENTNOTIFY's lParam should be in the mainframe's client
              coordinates, so convert to the status bar's coordinates using
              MapWindowPoints. Then get the pane's rect your interested in with
              the SB_GETRECT message, which I'm guessing is wrapped as GetRect or
              maybe GetPaneRect. Then use the PtInRect function to see if the
              mouse was clicked in the pane.

              -Roger
            Your message has been successfully submitted and would be delivered to recipients shortly.