NSOutlineView Travails

  • We are converting tables and outlines to view-based.  So far, so good, on
    tables.  But NSOutlineView has been a pain.  First of all, there is no
    documentation on this, zero, zip, nada, zilch, in the NSOutlineView
    Reference.  You have to rely on sample code and NSOutlineView.h.

    Our outline view has a column/cell identifier ³LineNumber², one for
    ³CheckBox², one for ³Outline².  Previously, the latter two were bound to our
    NSTreeController.  Converting to views (yes, using
    outlineView:viewForTableColumn:item:), we could not even get the nib to
    load.  ObjectValue always came up nil.  We tried binding the tableView to
    the tree controller ‹ still nil.  Ok, after examining sample code, we
    decided that just maybe there was something magic about the column/cell
    identifier ³MainCell², so we changed our third column/cell identifier and
    replaced @²Outline² with @²MainCell² in our code.  Amazing ‹ now the nib
    loads.  However, still no values.  Even worse, the turn-down dingy appears
    in the first column, not the third where we want it.  It does turn down the
    right number of times and depths to match our outline, but is in the wrong
    place and no values.

    So how do I get the outline back into the third column and get my
    objectValues to work?
  • On Apr 17, 2013, at 10:50 , Gordon Apple <ga...> wrote:

    > We are converting tables and outlines to view-based.  So far, so good, on
    > tables.  But NSOutlineView has been a pain.  First of all, there is no
    > documentation on this, zero, zip, nada, zilch, in the NSOutlineView
    > Reference.  You have to rely on sample code and NSOutlineView.h.

    Yup, the documentation situation for NSOutlineView is awful.

    > Our outline view has a column/cell identifier ³LineNumber², one for
    > ³CheckBox², one for ³Outline².  Previously, the latter two were bound to our
    > NSTreeController.  Converting to views (yes, using
    > outlineView:viewForTableColumn:item:), we could not even get the nib to
    > load.  ObjectValue always came up nil.  We tried binding the tableView to
    > the tree controller ‹ still nil.

    You can't "try" binding here. If you're using a data source, you don't bind the outline view to the tree controller, and in that case you need to set view.objectValue to the desired object before returning from 'outlineView:viewForTableColumn:item:'.

    Otherwise, you *must* bind the outline view's "content" binding to the tree controller, and the outline view should then maintain "objectValue" for you. (But since I always use data sources these days, I can't swear that this is precisely correct.)

    > Ok, after examining sample code, we
    > decided that just maybe there was something magic about the column/cell
    > identifier ³MainCell², so we changed our third column/cell identifier and
    > replaced @²Outline² with @²MainCell² in our code.  Amazing ‹ now the nib
    > loads.  However, still no values.

    Since you're talking about loading nibs, I assume you've got code to register the nib, and I bet you forgot to ensure that the nib is registered with with the identifier that matches what you're actually using.

    If I remember the details correctly, you're going to invoke 'makeViewWithIdentifier:owner:' inside 'outlineView:viewForTableColumn:item:'. When you're using registered nibs, you must use the identifier that the nib is registered under, and the identifier assigned to the built-in cell view (that you're not using) is irrelevant. When you're using the built-in cell view, you must use its identifier, of course.

    The column identifier is basically unrelated, unless you *choose* to configure it to match the actual cell view identifier. The table view documentation assumes this is desirable, but I've never found it makes anything much easier. All it does is provide the opportunity for things to get out of sync, as you discovered.

    > Even worse, the turn-down dingy appears
    > in the first column, not the third where we want it.  It does turn down the
    > right number of times and depths to match our outline, but is in the wrong
    > place and no values.
    >
    > So how do I get the outline back into the third column and get my
    > objectValues to work?

    Are you sure you aren't inadvertently returning a group row view, or a full-row view?
  • We had assumed that outlineView:objectValueForTableColumn:item was not
    called if the table was bound to a NSTreeController.  Wrong assumption.  If
    we returned the correct value, or just eliminated this method, it mostly
    works correctly.  However, there a few anomalies. The outline text indents
    properly, but the disclosure indicator occasionally (and randomly) appears
    anywhere it wants within the column/row.  Also, scrolling by clicking the
    bar lower sometimes results in flipping down to the right level, then
    immediately flipping back up to the view top.

    On 4/17/13 2:00 PM, "<cocoa-dev-request...>"
    <cocoa-dev-request...> wrote:

    > We are converting tables and outlines to view-based.  So far, so good, on
    > tables.  But NSOutlineView has been a pain.  First of all, there is no
    > documentation on this, zero, zip, nada, zilch, in the NSOutlineView Reference.
    > You have to rely on sample code and NSOutlineView.h. Our outline view has a
    > column/cell identifier ³LineNumber², one for ³CheckBox², one for ³Outline².
    > Previously, the latter two were bound to our NSTreeController.  Converting to
    > views (yes, using outlineView:viewForTableColumn:item:), we could not even get
    > the nib to load.  ObjectValue always came up nil.  We tried binding the
    > tableView to the tree controller ? still nil.  Ok, after examining sample
    > code, we decided that just maybe there was something magic about the
    > column/cell identifier ³MainCell², so we changed our third column/cell
    > identifier and replaced @²Outline² with @²MainCell² in our code.  Amazing ?
    > now the nib loads.  However, still no values.  Even worse, the turn-down dingy
    > appears in the first column, not the third where we want it.  It does turn
    > down the right number of times and depths to match our outline, but is in the
    > wrong place and no values. So how do I get the outline back into the third
    > column and get my objectValues to work?
  • By now, I¹m sure you¹ve seen my second posting.  That at least got things
    showing up in (mostly) the right place.  We always had a mixture of bindings
    and data source, mainly because line numbers were hard to do with bindings.
    With view=based tables and a little subclassing, it¹s not so hard.  For
    tables, you need the data source because if gives you the item and you can
    get rowFromItem and feed it back to it (offset by 1).  Things are still not
    right.  Our outlineView is not stable and it sometimes edits the wrong row.

    We want to add a hoverView to show popovers (works for tables), but we need
    the basics working predictably first.

    On 4/17/13 4:09 PM, "Quincey Morris" <quinceymorris...>
    wrote:

    > On Apr 17, 2013, at 10:50 , Gordon Apple <ga...> wrote:
    >
    >> We are converting tables and outlines to view-based.  So far, so good, on
    >> tables.  But NSOutlineView has been a pain.  First of all, there is no
    >> documentation on this, zero, zip, nada, zilch, in the NSOutlineView
    >> Reference.  You have to rely on sample code and NSOutlineView.h.
    >
    > Yup, the documentation situation for NSOutlineView is awful.
    >
    >> Our outline view has a column/cell identifier ³LineNumber², one for
    >> ³CheckBox², one for ³Outline².  Previously, the latter two were bound to our
    >> NSTreeController.  Converting to views (yes, using
    >> outlineView:viewForTableColumn:item:), we could not even get the nib to
    >> load.  ObjectValue always came up nil.  We tried binding the tableView to
    >> the tree controller ‹ still nil.
    >
    > You can't "try" binding here. If you're using a data source, you don't bind
    > the outline view to the tree controller, and in that case you need to set
    > view.objectValue to the desired object before returning from
    > 'outlineView:viewForTableColumn:item:'.
    >
    > Otherwise, you *must* bind the outline view's "content" binding to the tree
    > controller, and the outline view should then maintain "objectValue" for you.
    > (But since I always use data sources these days, I can't swear that this is
    > precisely correct.)
    >
    >> Ok, after examining sample code, we
    >> decided that just maybe there was something magic about the column/cell
    >> identifier ³MainCell², so we changed our third column/cell identifier and
    >> replaced @²Outline² with @²MainCell² in our code.  Amazing ‹ now the nib
    >> loads.  However, still no values.
    >
    > Since you're talking about loading nibs, I assume you've got code to register
    > the nib, and I bet you forgot to ensure that the nib is registered with with
    > the identifier that matches what you're actually using.
    >
    > If I remember the details correctly, you're going to invoke
    > 'makeViewWithIdentifier:owner:' inside 'outlineView:viewForTableColumn:item:'.
    > When you're using registered nibs, you must use the identifier that the nib is
    > registered under, and the identifier assigned to the built-in cell view (that
    > you're not using) is irrelevant. When you're using the built-in cell view, you
    > must use its identifier, of course.
    >
    > The column identifier is basically unrelated, unless you *choose* to configure
    > it to match the actual cell view identifier. The table view documentation
    > assumes this is desirable, but I've never found it makes anything much easier.
    > All it does is provide the opportunity for things to get out of sync, as you
    > discovered.
    >
    >> Even worse, the turn-down dingy appears
    >> in the first column, not the third where we want it.  It does turn down the
    >> right number of times and depths to match our outline, but is in the wrong
    >> place and no values.
    >>
    >> So how do I get the outline back into the third column and get my
    >> objectValues to work?
    >
    > Are you sure you aren't inadvertently returning a group row view, or a
    > full-row view?
    >
    >

    --
    Gordon Apple
    Ed4U
    Little Rock, AR
  • On Apr 17, 2013, at 18:08 , Gordon Apple <ga...> wrote:

    > Our outlineView is not stable and it sometimes edits the wrong row.

    FWIW, the several times I saw instability and other odd behavior, it turned out I was doing something to the outline view on a non-main thread. The odd behavior didn't necessarily show up instantly.
  • Our view-based NSOutlineView still has a few annomalies, but mostly works.
    Now, we are attempting to install a hoverView in our outline column to
    launch a popover (display only) when mousing over a row.  This works just
    fine with NSTableViews, but so far does not work at all with NSOutlineView.
    We had hoped this would not be a problem because NSOutlineView is a subclass
    of NSTableView.  Our theory is that because the presence of turn-down
    buttons in the outline view, there must be an additional intervening view
    that handle this and related layout issues within the cell.  Has anyone
    successfully used a hoverView with NSOutlineView?

    BTW, a word to the wise.  Bindings to arrayControllers through a
    viewController¹s representedObject is still problematic.  We have filed bug
    reports on this in the past (confirmed bug).
  • On Apr 17, 2013, at 2:09 PM, Quincey Morris <quinceymorris...> wrote:

    > On Apr 17, 2013, at 10:50 , Gordon Apple <ga...> wrote:
    >
    >> We are converting tables and outlines to view-based.  So far, so good, on
    >> tables.  But NSOutlineView has been a pain.  First of all, there is no
    >> documentation on this, zero, zip, nada, zilch, in the NSOutlineView
    >> Reference.  You have to rely on sample code and NSOutlineView.h.
    >
    > Yup, the documentation situation for NSOutlineView is awful.

    You should log bugs at bugreporter.apple.com asking for specific things you would like to see better. Please be specific; general statements like "X is terrible" don't help us know what you are wanting to know. A better thing would be to say "I don't understand how to begin editing in NSOutlineView.." or "it took me a long time to figure out XX, and it should be documented".

    corbin

    >
    >> Our outline view has a column/cell identifier ³LineNumber², one for
    >> ³CheckBox², one for ³Outline².  Previously, the latter two were bound to our
    >> NSTreeController.  Converting to views (yes, using
    >> outlineView:viewForTableColumn:item:), we could not even get the nib to
    >> load.  ObjectValue always came up nil.  We tried binding the tableView to
    >> the tree controller ‹ still nil.
    >
    > You can't "try" binding here. If you're using a data source, you don't bind the outline view to the tree controller, and in that case you need to set view.objectValue to the desired object before returning from 'outlineView:viewForTableColumn:item:'.
    >
    > Otherwise, you *must* bind the outline view's "content" binding to the tree controller, and the outline view should then maintain "objectValue" for you. (But since I always use data sources these days, I can't swear that this is precisely correct.)
    >
    >> Ok, after examining sample code, we
    >> decided that just maybe there was something magic about the column/cell
    >> identifier ³MainCell², so we changed our third column/cell identifier and
    >> replaced @²Outline² with @²MainCell² in our code.  Amazing ‹ now the nib
    >> loads.  However, still no values.
    >
    > Since you're talking about loading nibs, I assume you've got code to register the nib, and I bet you forgot to ensure that the nib is registered with with the identifier that matches what you're actually using.
    >
    > If I remember the details correctly, you're going to invoke 'makeViewWithIdentifier:owner:' inside 'outlineView:viewForTableColumn:item:'. When you're using registered nibs, you must use the identifier that the nib is registered under, and the identifier assigned to the built-in cell view (that you're not using) is irrelevant. When you're using the built-in cell view, you must use its identifier, of course.
    >
    > The column identifier is basically unrelated, unless you *choose* to configure it to match the actual cell view identifier. The table view documentation assumes this is desirable, but I've never found it makes anything much easier. All it does is provide the opportunity for things to get out of sync, as you discovered.
    >
    >> Even worse, the turn-down dingy appears
    >> in the first column, not the third where we want it.  It does turn down the
    >> right number of times and depths to match our outline, but is in the wrong
    >> place and no values.
    >>
    >> So how do I get the outline back into the third column and get my
    >> objectValues to work?
    >
    > Are you sure you aren't inadvertently returning a group row view, or a full-row view?
  • On Apr 21, 2013, at 11:51 AM, Gordon Apple <ga...> wrote:

    > Our view-based NSOutlineView still has a few annomalies, but mostly works.
    > Now, we are attempting to install a hoverView in our outline column to
    > launch a popover (display only) when mousing over a row.  This works just
    > fine with NSTableViews, but so far does not work at all with NSOutlineView.
    > We had hoped this would not be a problem because NSOutlineView is a subclass
    > of NSTableView.  Our theory is that because the presence of turn-down
    > buttons in the outline view, there must be an additional intervening view
    > that handle this and related layout issues within the cell.  Has anyone
    > successfully used a hoverView with NSOutlineView?

    No, there isn't any additional intervening of the views. Visually, the view based NSOutlineView is a super-thin wrapper around NSTableView to add indentation and a disclosure triangle. If it works in NSTableView, it will work in NSotulineView, and something else is likely wrong.

    Things that would be useful to know:
    1. How you are trying to show a popover. (i.e.: relevant code)
    2. When you are doing it, and when is it not happening

    >
    > BTW, a word to the wise.  Bindings to arrayControllers through a
    > viewController¹s representedObject is still problematic.  We have filed bug
    > reports on this in the past (confirmed bug).

    What is the radar you logged for this?

    NSTableView and NSOutlineView doesn't use a viewController.

    corbin
  • On May 2, 2013, at 14:52 , Corbin Dunn <corbind...> wrote:

    > On Apr 17, 2013, at 2:09 PM, Quincey Morris <quinceymorris...> wrote:
    >
    >> On Apr 17, 2013, at 10:50 , Gordon Apple <ga...> wrote:
    >>
    >>> We are converting tables and outlines to view-based.  So far, so good, on
    >>> tables.  But NSOutlineView has been a pain.  First of all, there is no
    >>> documentation on this, zero, zip, nada, zilch, in the NSOutlineView
    >>> Reference.  You have to rely on sample code and NSOutlineView.h.
    >>
    >> Yup, the documentation situation for NSOutlineView is awful.
    >
    > You should log bugs at bugreporter.apple.com asking for specific things you would like to see better. Please be specific; general statements like "X is terrible" don't help us know what you are wanting to know. A better thing would be to say "I don't understand how to begin editing in NSOutlineView.." or "it took me a long time to figure out XX, and it should be documented".

    Yes, I know. But Gordon already said the specific thing: "there is no documentation on [view-based outline views], zero, zip, nada, zilch".

    This isn't just about programming guides. The delegate method 'outlineView:viewForTableColumn:item:' isn't even mentioned in the NSOutlineViewDelegate protocol reference documentation. Zero, zip, nada, zilch.

    Under the circumstances, I think it's a little hilarious to be asked to meticulously bug-report what will "'help us know what you are wanting to know".
  • On May 2, 2013, at 3:15 PM, Quincey Morris <quinceymorris...> wrote:

    > On May 2, 2013, at 14:52 , Corbin Dunn <corbind...> wrote:
    >
    >> On Apr 17, 2013, at 2:09 PM, Quincey Morris <quinceymorris...> wrote:
    >>
    >>> On Apr 17, 2013, at 10:50 , Gordon Apple <ga...> wrote:
    >>>
    >>>> We are converting tables and outlines to view-based.  So far, so good, on
    >>>> tables.  But NSOutlineView has been a pain.  First of all, there is no
    >>>> documentation on this, zero, zip, nada, zilch, in the NSOutlineView
    >>>> Reference.  You have to rely on sample code and NSOutlineView.h.
    >>>
    >>> Yup, the documentation situation for NSOutlineView is awful.
    >>
    >> You should log bugs at bugreporter.apple.com asking for specific things you would like to see better. Please be specific; general statements like "X is terrible" don't help us know what you are wanting to know. A better thing would be to say "I don't understand how to begin editing in NSOutlineView.." or "it took me a long time to figure out XX, and it should be documented".
    >
    > Yes, I know. But Gordon already said the specific thing: "there is no documentation on [view-based outline views], zero, zip, nada, zilch".
    >
    > This isn't just about programming guides. The delegate method 'outlineView:viewForTableColumn:item:' isn't even mentioned in the NSOutlineViewDelegate protocol reference documentation. Zero, zip, nada, zilch.
    >
    > Under the circumstances, I think it's a little hilarious to be asked to meticulously bug-report what will "'help us know what you are wanting to know".

    There isn't zero documentation; 95% of the functionality comes from NSTableView, which is well documented. The outline view methods are really just cover methods for the NSTableView ones.

    But like I said, please log a bug requesting it be documented. Your specific case here would be to document the view based outline view delegate methods.  But to be fair, the header is fairly verbose (well, terse in the case for those methods...because they are just cover methods  as I said).

    corbin
previous month april 2013 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