• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Custom-view cursor changing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom-view cursor changing


  • Subject: Custom-view cursor changing
  • From: John Stiles <email@hidden>
  • Date: Tue, 27 Nov 2007 13:46:46 -0800

I have a custom NSView subclass which overrides -mouseDown:, -mouseDragged: and -mouseUp:. In response to dragging, the control can resize itself and some ancillary views in the window (within a limited range, of course). Conceptually it's a lot like a split view.

I am trying to change the cursor when the drag starts by calling [myCursor push] inside -mouseDown:, and restoring it via [NSCursor pop] inside -mouseUp:. I'm finding that if I just click and release, this works great.

However, dragging does not work as expected. When -mouseDragged: is called and I change various views' bounds (via setFrame), suddenly the cursor pops back to being an arrow cursor.

This appears to be happening because some view I'm using is posting a notification saying that it needs to reset its cursor rects. When I set a breakpoint on -[NSCursor set], I get this:

#0 0x911034d6 in -[NSCursor set]
#1 0x913dbafd in -[NSWindow resetCursorRects]
#2 0x91108315 in _handleInvalidCursorRectsNote
#3 0x90f039e2 in __CFRunLoopDoObservers
#4 0x90f04d45 in CFRunLoopRunSpecific
#5 0x90f05d38 in CFRunLoopRunInMode
#6 0x92cf28a4 in RunCurrentEventLoopInMode
#7 0x92cf25f6 in ReceiveNextEventCommon
#8 0x92cf2531 in BlockUntilNextEventMatchingListInMode
#9 0x9107cd5b in _DPSNextEvent
#10 0x9107c6a0 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#11 0x910756d1 in -[NSApplication run]


I don't know exactly how to solve this, though. I'm definitely not posting anything like this, and the other views involved are all standard OS X NSViews (e.g. in this case there are NSOutlineViews, NSButtons and NSTextViews… not exactly rocket science).

Has anyone seen this before and maybe found a workaround? Maybe I need to do something to enable "live-resize mode" in my mouseDown/mouseUp methods?

I notice that I'm not alone—Xcode has the same problem when dragging its splitter in the main project window.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Custom-view cursor changing
      • From: Uli Kusterer <email@hidden>
    • Re: Custom-view cursor changing
      • From: John Stiles <email@hidden>
  • Prev by Date: Re: NSConditionLock console message: "unlocked from thread which did not lock it"
  • Next by Date: Re: Custom-view cursor changing
  • Previous by thread: Re: Force redisplay of NSTextField after NSFormatter subclass change
  • Next by thread: Re: Custom-view cursor changing
  • Index(es):
    • Date
    • Thread