How to "capture" the mouse

  • I am developing a systemStatusBar bound application

    that uses a Custom View [systemStatusBar setView: myView]

    myView implements mouseDown and all it does is shows a window just
    bellow the status bar

    That all works perfectly.

    Now, when the user clicks anywhere outside the status bar, the
    application needs to Hide the window.
    On what even do I hide the window? mouseDown or any other mouse related
    NSResponder event does not get called when it occurs outside of the view
    client area.

    I am looking for something like capturing the mouse on windows.

    Thank you!
  • On Feb 1, 2008, at 11:09 AM, Vance wrote:

    > Now, when the user clicks anywhere outside the status bar, the
    > application needs to Hide the window.
    > On what even do I hide the window? mouseDown or any other mouse
    > related NSResponder event does not get called when it occurs outside
    > of the view client area.

    Why do you need to open a window, why not just use a regular menu with
    a custom view? One obvious answer to that question might be that you
    need to support versions of Mac OS X prior to Leopard - Is that the
    case?

    On 10.4 and later you can probably use the CGEventTap API to find the
    information that you're looking for.

    j o a r
  • j o a r wrote:
    >
    > On Feb 1, 2008, at 11:09 AM, Vance wrote:
    >
    >> Now, when the user clicks anywhere outside the status bar, the
    >> application needs to Hide the window.
    >> On what even do I hide the window? mouseDown or any other mouse
    >> related NSResponder event does not get called when it occurs outside
    >> of the view client area.
    >
    >
    > Why do you need to open a window, why not just use a regular menu with
    > a custom view? One obvious answer to that question might be that you
    > need to support versions of Mac OS X prior to Leopard - Is that the case?
    >
    > On 10.4 and later you can probably use the CGEventTap API to find the
    > information that you're looking for.
    >
    > j o a r
    >
    >
    Cool, thank you! Looks like what I needed, I will give it a try now and
    see how it works.

    I want it to provide a custom control on the system menu, that has one
    small icon and an arrow next to it. When the user clicks on the arrow,
    it changes between location that he is interested in monitoring at the
    moment. And when the user clicks on the icon, a custom window is shown
    with all the details. So it is just a much more convenient way to change
    locations. And of course this "arrow button" would be hidden/shown on
    the custom status bar as set in the preferences dialog to conserve
    space. Just want to make it as easy as possible to use and save clicks
    for some users.

    Thanks!
    Vance
  • I see a huge performance degradation  with this method.

    Does anyone know how is this implemented with drag/drop.

    I see the application keeps receiving drag messages, even when the mouse
    pointer is outside the window, until the mouse up event fires.

    Thanks!

    Vance wrote:
    > j o a r wrote:
    >>
    >> On Feb 1, 2008, at 11:09 AM, Vance wrote:
    >>
    >>> Now, when the user clicks anywhere outside the status bar, the
    >>> application needs to Hide the window.
    >>> On what even do I hide the window? mouseDown or any other mouse
    >>> related NSResponder event does not get called when it occurs outside
    >>> of the view client area.
    >>
    >>
    >> Why do you need to open a window, why not just use a regular menu
    >> with a custom view? One obvious answer to that question might be that
    >> you need to support versions of Mac OS X prior to Leopard - Is that
    >> the case?
    >>
    >> On 10.4 and later you can probably use the CGEventTap API to find the
    >> information that you're looking for.
    >>
    >> j o a r
    >>
    >>
    > Cool, thank you! Looks like what I needed, I will give it a try now
    > and see how it works.
    >
    > I want it to provide a custom control on the system menu, that has one
    > small icon and an arrow next to it. When the user clicks on the arrow,
    > it changes between location that he is interested in monitoring at the
    > moment. And when the user clicks on the icon, a custom window is shown
    > with all the details. So it is just a much more convenient way to
    > change locations. And of course this "arrow button" would be
    > hidden/shown on the custom status bar as set in the preferences dialog
    > to conserve space. Just want to make it as easy as possible to use and
    > save clicks for some users.
    >
    > Thanks!
    > Vance
previous month february 2008 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29    
Go to today