Outline View drawing changes in Leopard?

  • I'm seeing some new drawing behaviors in Leopard that are wreaking havoc on
    some of the hackery I put in place under Tiger.
    I'm using an NSOutlineView with variable row heights (hack #1), and I've
    implemented a custom table column data cell that uses an NSTableView to
    render a mini-table within some of the columns in the view (hack #2).  (My
    "MultiRowSubviewCell" is based loosely on some sample code published by Joar
    Wingfors a few years ago; more on the implementation below.)

    At first, my view renders normally.  If I instrument the code, it renders
    each row in sequence, and the columns in sequence within the row, once per
    redraw, invoking drawWithFrame:inView once per cell.

    But if I edit a cell (a "normal" NSTextFieldCell) in the view and complete
    the edit, the drawing behavior goes south: it renders each row normally, but
    on the last row, within a call to -display on my inner table view, the
    outline view starts rendering the remaining columns from the top, and when
    it gets to the last row of the inner loop, it starts another inner loop on
    the remaining columns, and so on.  This agony is repeated every time it
    encounters a last row.  It's not infinite recursion, but it's one or two
    orders of magnitude too many calls, and it makes the application unusable.

    So, the bad rendering pattern is:

    First row, first column
    First row, 2nd column
    ...
    Next to last row, last column
    Last row, first column
        First row, 2nd column (again)
        First row, 3rd column
        ...
        Last row, 2nd column
            First row, 3rd column (yet again)
            ...
            Last row,  3rd column
                First row, 4th column
                ...
                Last row, 4th column
            Last row, 4th column
        Last row, 3rd column
            First row, 4th column
            ....
        Last row, 4th column
    Last row, 2nd column
        First row, 3rd column
        ad nauseum

    A few things I've tried to make sense of:

    - What is the significance of editing a cell to trigger the bad behavior?  I
    assume it's related to the first invocation of the window's field editor...

    - What is the correct way under Leopard to implement a cell that uses a
    subview to render itself?  My cell's drawWithFrame:inView method...
        - fetches the prepared subview from a controller object
        - sets its frame to the specified rectangle
        - if necessary, adds it as a sub-view to the view it's being rendered in
        - invokes display on it
        - invokes removeFromSuperviewWithoutNeedingDisplay  (not in Joar's
    sample code, but which I found necessary by trial and error)

    - Why would a table view re-render most of itself from within a single
    (admittedly non-standard) cell's drawWithFrame:inView method?

    Thanks for any thoughts...

    Doug K;
  • Well, first let me apologize for not having read much of your message,
    but there's a boatload of NSTableView and NSOutlineView behavior
    changes, with some coping advice, in the release notes:

    http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSTableView
previous month november 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    
Go to today