Unwanted cursor

  • Hi,
    I put an NSScrollingView in the center of a window, leaving some border to
    the left and to the right. I put an NSView within a NSScrollingView.
    Within this NSView, scrollable, I put several graphic objects MYObj,
    subclass of NSViews. Then I define an NSCursor for each MYObj within the
    resetCursorRects method.

        [self addCursorRect:[self frame] cursor:theCursor];
        [theCursor setOnMouseEntered:YES];
        [theCursor setOnMouseExited:NO];

    Everything works well. When I rollover the objects I can see theCursor.
    Now I scroll the scrollingView horizontally such a way an object goes hidden
    out of the scrollingView , let's say at the left side or the right side out
    of the scrollingView. Well, now if I rollover the mouse just on the window,
    out of the scrollingView, I still see the cursor. It seems that the mouse
    detects the position of MYObj even when not visible in the scrolling view,
    due to the scroll.

    How can I fix this?

    Best Regards
    --
    Lorenzo
    email: <archidea...>
  • On 24 Oct 2007, at 8:09 AM, Lorenzo wrote:

    > I put an NSScrollingView in the center of a window, leaving some
    > border to
    > the left and to the right. I put an NSView within a NSScrollingView.
    > Within this NSView, scrollable, I put several graphic objects MYObj,
    > subclass of NSViews. Then I define an NSCursor for each MYObj within
    > the
    > resetCursorRects method.
    >
    > [self addCursorRect:[self frame] cursor:theCursor];
    > [theCursor setOnMouseEntered:YES];
    > [theCursor setOnMouseExited:NO];
    >
    > Everything works well. When I rollover the objects I can see
    > theCursor.
    > Now I scroll the scrollingView horizontally such a way an object
    > goes hidden
    > out of the scrollingView , let's say at the left side or the right
    > side out
    > of the scrollingView. Well, now if I rollover the mouse just on the
    > window,
    > out of the scrollingView, I still see the cursor. It seems that the
    > mouse
    > detects the position of MYObj even when not visible in the scrolling
    > view,
    > due to the scroll.

    Have you considered the following from the documentation of
    addCursorRect:cursor: ?

    > Cursor rectangles aren’t subject to clipping by superviews, nor are
    > they intended for use with rotated views. You should explicitly
    > confine a cursor rectangle to the view's visible rectangle to
    > prevent improper behavior.

    See also NSIntersectionRect().

    — F
  • Yes Fritz, I have realized that and intersected the rect just with the
    visibleRect. Now it works well. Thanks.

    Best Regards
    --
    Lorenzo
    email: <archidea...>

    > From: Fritz Anderson <fritza...>
    > Date: Wed, 24 Oct 2007 11:06:32 -0500
    > To: Lorenzo <archidea...>
    > Cc: <cocoa-dev...>
    > Subject: Re: Unwanted cursor
    >
    > On 24 Oct 2007, at 8:09 AM, Lorenzo wrote:
    >
    >> I put an NSScrollingView in the center of a window, leaving some
    >> border to
    >> the left and to the right. I put an NSView within a NSScrollingView.
    >> Within this NSView, scrollable, I put several graphic objects MYObj,
    >> subclass of NSViews. Then I define an NSCursor for each MYObj within
    >> the
    >> resetCursorRects method.
    >>
    >> [self addCursorRect:[self frame] cursor:theCursor];
    >> [theCursor setOnMouseEntered:YES];
    >> [theCursor setOnMouseExited:NO];
    >>
    >> Everything works well. When I rollover the objects I can see
    >> theCursor.
    >> Now I scroll the scrollingView horizontally such a way an object
    >> goes hidden
    >> out of the scrollingView , let's say at the left side or the right
    >> side out
    >> of the scrollingView. Well, now if I rollover the mouse just on the
    >> window,
    >> out of the scrollingView, I still see the cursor. It seems that the
    >> mouse
    >> detects the position of MYObj even when not visible in the scrolling
    >> view,
    >> due to the scroll.
    >
    > Have you considered the following from the documentation of
    > addCursorRect:cursor: ?
    >
    >> Cursor rectangles aren¹t subject to clipping by superviews, nor are
    >> they intended for use with rotated views. You should explicitly
    >> confine a cursor rectangle to the view's visible rectangle to
    >> prevent improper behavior.
    >
    > See also NSIntersectionRect().
    >
    > ‹ F
    >
previous month october 2007 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 30 31        
Go to today