Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cbswe

macrumors member
Original poster
Jan 11, 2010
40
0
Hi!

I discovered a wierd property of cocoa and cursor rects.

I have three layers of different sizes that are all subclasses of NSView.
They contain cursor-rects and they are not always the same. I want
the cursor to be what the cursor rect of the topmost layer in whatever
area the mouse cursor is positioned above to be the determining one.

And it works properly as long as my mouse cursor never leave the main window.
If it does and I re-enter the window with the cursor, the cursor-rects determability is suddenly sorted, not by layer, but by the time I added them.
So the newer curs-rect always will be the determening one of its area.

Anyone familiar with this problem and/or know of a work-around or solution?


Thanks
Carl
 
Solved it.

I added [self discardCursorRects] in the beginning of the overridden resetCursorRects and all the weird properties magically vanished.

I had tried loads and loads of different solutions (a lot of them involving removeCursorRect) and I finally tried this strategy after peaking in apples example project "DragItemAround".

Thanks apple
:apple: :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.