Problem with cursor rects

Discussion in 'Mac Programming' started by Cbswe, Jan 23, 2010.

  1. Cbswe macrumors member

    Joined:
    Jan 11, 2010
    #1
    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
     
  2. Cbswe thread starter macrumors member

    Joined:
    Jan 11, 2010
    #2
    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: :)
     

Share This Page