willDisplayOutlineCell of view-based NSOutlineView is not called

  • Hi,

    I want to customize the disclosure arrow appearance in my view-based NSOutlineView.
    I overrode the willDisplayOutlineCell delegate method, but it's not called.
    The willDisplayCell delegate method - is not called either. Is it known issue or I'm missing something?

    (The isItemExpandable delegate function and isGroupItem returns YES for the expandable cell)

    Thanks,

    Nava
  • isItemExpandable and isGroupItem have nothing to do with NSCells. They're called for the items.

    Cell-based table and outlineView reuse the cells for each row; this was a memory-saving technique 20 years ago, not so useful today. So before they drew a particular cell it had to be configured for the item; that's what the willDisplayCell methods are for.

    outlineView:viewForTableColumn:item: is where you can create custom views.

    ----- Original Message -----
    From: "Nava Carmon" <ncarmon...>
    To: <cocoa-dev...>
    Sent: Thursday, June 21, 2012 12:27:02 AM
    Subject: willDisplayOutlineCell of view-based NSOutlineView is not called

    Hi,

    I want to customize the disclosure arrow appearance in my view-based NSOutlineView.
    I overrode the willDisplayOutlineCell delegate method, but it's not called.
    The willDisplayCell delegate method - is not called either. Is it known issue or I'm missing something?

    (The isItemExpandable delegate function and isGroupItem returns YES for the expandable cell)

    Thanks,

    Nava
  • Thanks for reply.

    On Jun 21, 2012, at 11:05 AM, Lee Ann Rucker wrote:

    > isItemExpandable and isGroupItem have nothing to do with NSCells. They're called for the items.
    >
    > Cell-based table and outlineView reuse the cells for each row; this was a memory-saving technique 20 years ago, not so useful today. So before they drew a particular cell it had to be configured for the item; that's what the willDisplayCell methods are for.
    >
    > outlineView:viewForTableColumn:item: is where you can create custom views.

    I use this delegate method also to return a custom cell view. I have different views for group and regular cells. The problem is that the view position comes next to the disclosure button cell and not instead of it so the disclosure cell appearance stays default no matter what i try to do.

    And this is what apple documentation says on this:

    outlineView:willDisplayOutlineCell:forTableColumn:item:
    Informs the delegate that an outline view is about to display a cell used to draw the expansion symbol.
    - (void)outlineView:(NSOutlineView *)outlineView willDisplayOutlineCell:(id)cell
    forTableColumn:(NSTableColumn *)tableColumn item:(id)item
    Discussion
      Informs the delegate that outlineView is about to display cell—an expandable cell (a cell that has the
      expansion symbol)—for the column and item specified by tableColumn and item. The delegate can modify
      cell to alter its display attributes.
    This method is not invoked when outlineView is about to display a non-expandable cell.

    So the cell has to be expandable to get this call

    >
    > ----- Original Message -----
    > From: "Nava Carmon" <ncarmon...>
    > To: <cocoa-dev...>
    > Sent: Thursday, June 21, 2012 12:27:02 AM
    > Subject: willDisplayOutlineCell of view-based NSOutlineView is not called
    >
    > Hi,
    >
    > I want to customize the disclosure arrow appearance in my view-based NSOutlineView.
    > I overrode the willDisplayOutlineCell delegate method, but it's not called.
    > The willDisplayCell delegate method - is not called either. Is it known issue or I'm missing something?
    >
    > (The isItemExpandable delegate function and isGroupItem returns YES for the expandable cell)
    >
    > Thanks,
    >
    > Nava
  • On Jun 21, 2012, at 1:22 AM, Nava Carmon <ncarmon...> wrote:

    >
    >
    >
    > And this is what apple documentation says on this:
    >
    > outlineView:willDisplayOutlineCell:forTableColumn:item:
    > Informs the delegate that an outline view is about to display a cell used to draw the expansion symbol.

    _There are no cells_ in a *view-based* outline view.

    Either on this list or in the developer forums (devforums.apple.com), Corbin Dunn acknowledged that lack of customizability of disclosure triangles is a known shortcoming with view-based outline views. He mentioned a workaround that involves looking for a subviews with a certain identifier.

    --Kyle Sluder
  • On Jun 21, 2012, at 7:45 AM, Kyle Sluder <kyle...> wrote:

    > On Jun 21, 2012, at 1:22 AM, Nava Carmon <ncarmon...> wrote:
    >
    >>
    >>
    >>
    >> And this is what apple documentation says on this:
    >>
    >> outlineView:willDisplayOutlineCell:forTableColumn:item:
    >> Informs the delegate that an outline view is about to display a cell used to draw the expansion symbol.
    >
    > _There are no cells_ in a *view-based* outline view.
    >
    > Either on this list or in the developer forums (devforums.apple.com), Corbin Dunn acknowledged that lack of customizability of disclosure triangles is a known shortcoming with view-based outline views. He mentioned a workaround that involves looking for a subviews with a certain identifier.

    Please do log a bug requesting this functionality so we can expose it in an easy way.

    Yes, the documentation should be more clear too -- please log a bug on that also.

    Another alternative is to hide the disclosure triangle and add your own button that does it. It just would call expandItem or collapseItem as needed.

    corbin
  • Thank you all for answering.

    Corbin, where is the best place to add my own disclosure button?
    I believe not in the view itself, since it's indented.

    Thanks

    On Jun 21, 2012, at 7:25 PM, Corbin Dunn wrote:

    >
    > On Jun 21, 2012, at 7:45 AM, Kyle Sluder <kyle...> wrote:
    >
    >> On Jun 21, 2012, at 1:22 AM, Nava Carmon <ncarmon...> wrote:
    >>
    >>>
    >>>
    >>>
    >>> And this is what apple documentation says on this:
    >>>
    >>> outlineView:willDisplayOutlineCell:forTableColumn:item:
    >>> Informs the delegate that an outline view is about to display a cell used to draw the expansion symbol.
    >>
    >> _There are no cells_ in a *view-based* outline view.
    >>
    >> Either on this list or in the developer forums (devforums.apple.com), Corbin Dunn acknowledged that lack of customizability of disclosure triangles is a known shortcoming with view-based outline views. He mentioned a workaround that involves looking for a subviews with a certain identifier.
    >
    > Please do log a bug requesting this functionality so we can expose it in an easy way.
    >
    > Yes, the documentation should be more clear too -- please log a bug on that also.
    >
    > Another alternative is to hide the disclosure triangle and add your own button that does it. It just would call expandItem or collapseItem as needed.
    >
    > corbin
    >
    >
  • Just for those who need to customize their outline view disclosure arrow:
    Here's the answer from SO, that worked perfectly for me.

    http://stackoverflow.com/questions/11127764/how-to-customize-disclosure-cel
    l-in-view-based-nsoutlineview


    Best Regards,

    Nava Carmon,

    Moshiach Times Ltd.,

    e-mail: <ncarmon...>
    Skype: navacarmon
    Phone: +972.52.8157770

    On Jun 21, 2012, at 7:27 PM, Nava Carmon wrote:

    > Thank you all for answering.
    >
    > Corbin, where is the best place to add my own disclosure button?
    > I believe not in the view itself, since it's indented.
    >
    > Thanks
    >
    >
    >
    > On Jun 21, 2012, at 7:25 PM, Corbin Dunn wrote:
    >
    >>
    >> On Jun 21, 2012, at 7:45 AM, Kyle Sluder <kyle...> wrote:
    >>
    >>> On Jun 21, 2012, at 1:22 AM, Nava Carmon <ncarmon...> wrote:
    >>>
    >>>>
    >>>>
    >>>>
    >>>> And this is what apple documentation says on this:
    >>>>
    >>>> outlineView:willDisplayOutlineCell:forTableColumn:item:
    >>>> Informs the delegate that an outline view is about to display a cell used to draw the expansion symbol.
    >>>
    >>> _There are no cells_ in a *view-based* outline view.
    >>>
    >>> Either on this list or in the developer forums (devforums.apple.com), Corbin Dunn acknowledged that lack of customizability of disclosure triangles is a known shortcoming with view-based outline views. He mentioned a workaround that involves looking for a subviews with a certain identifier.
    >>
    >> Please do log a bug requesting this functionality so we can expose it in an easy way.
    >>
    >> Yes, the documentation should be more clear too -- please log a bug on that also.
    >>
    >> Another alternative is to hide the disclosure triangle and add your own button that does it. It just would call expandItem or collapseItem as needed.
    >>
    >> corbin
    >>
    >>

  • You really want to call [super didAddSubview:] in that code snippet.

    corbin

    On Jun 23, 2012, at 2:29 PM, Nava Carmon <ncarmon...> wrote:

    > Just for those who need to customize their outline view disclosure arrow:
    > Here's the answer from SO, that worked perfectly for me.
    >
    > http://stackoverflow.com/questions/11127764/how-to-customize-disclosure-cel
    l-in-view-based-nsoutlineview

    >
    >
    > Best Regards,
    >
    > Nava Carmon,
    >
    > Moshiach Times Ltd.,
    >
    > e-mail: <ncarmon...>
    > Skype: navacarmon
    > Phone: +972.52.8157770
    >
    >
    >
    >
    > On Jun 21, 2012, at 7:27 PM, Nava Carmon wrote:
    >
    >> Thank you all for answering.
    >>
    >> Corbin, where is the best place to add my own disclosure button?
    >> I believe not in the view itself, since it's indented.
    >>
    >> Thanks
    >>
    >>
    >>
    >> On Jun 21, 2012, at 7:25 PM, Corbin Dunn wrote:
    >>
    >>>
    >>> On Jun 21, 2012, at 7:45 AM, Kyle Sluder <kyle...> wrote:
    >>>
    >>>> On Jun 21, 2012, at 1:22 AM, Nava Carmon <ncarmon...> wrote:
    >>>>
    >>>>>
    >>>>>
    >>>>>
    >>>>> And this is what apple documentation says on this:
    >>>>>
    >>>>> outlineView:willDisplayOutlineCell:forTableColumn:item:
    >>>>> Informs the delegate that an outline view is about to display a cell used to draw the expansion symbol.
    >>>>
    >>>> _There are no cells_ in a *view-based* outline view.
    >>>>
    >>>> Either on this list or in the developer forums (devforums.apple.com), Corbin Dunn acknowledged that lack of customizability of disclosure triangles is a known shortcoming with view-based outline views. He mentioned a workaround that involves looking for a subviews with a certain identifier.
    >>>
    >>> Please do log a bug requesting this functionality so we can expose it in an easy way.
    >>>
    >>> Yes, the documentation should be more clear too -- please log a bug on that also.
    >>>
    >>> Another alternative is to hide the disclosure triangle and add your own button that does it. It just would call expandItem or collapseItem as needed.
    >>>
    >>> corbin
    >>>
    >>>


  • As the guy who provided this snippet, I just want to say that it has been fixed on SO in the hope that future users of that site don't get confused.

    Thanks for catching the missing call to super.

    M Larsen

    On 25 Jun 2012, at 22:32, Corbin Dunn wrote:

    > You really want to call [super didAddSubview:] in that code snippet.
    >
    > corbin
    >
    > On Jun 23, 2012, at 2:29 PM, Nava Carmon <ncarmon...> wrote:
    >
    >> Just for those who need to customize their outline view disclosure arrow:
    >> Here's the answer from SO, that worked perfectly for me.
    >>
    >> http://stackoverflow.com/questions/11127764/how-to-customize-disclosure-cel
    l-in-view-based-nsoutlineview

    >>
    >>
    >> Best Regards,
    >>
    >> Nava Carmon,
    >>
    >> Moshiach Times Ltd.,
    >>
    >> e-mail: <ncarmon...>
    >> Skype: navacarmon
    >> Phone: +972.52.8157770
    >>
    >>
    >>
    >>
    >> On Jun 21, 2012, at 7:27 PM, Nava Carmon wrote:
    >>
    >>> Thank you all for answering.
    >>>
    >>> Corbin, where is the best place to add my own disclosure button?
    >>> I believe not in the view itself, since it's indented.
    >>>
    >>> Thanks
    >>>
    >>>
    >>>
    >>> On Jun 21, 2012, at 7:25 PM, Corbin Dunn wrote:
    >>>
    >>>>
    >>>> On Jun 21, 2012, at 7:45 AM, Kyle Sluder <kyle...> wrote:
    >>>>
    >>>>> On Jun 21, 2012, at 1:22 AM, Nava Carmon <ncarmon...> wrote:
    >>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>> And this is what apple documentation says on this:
    >>>>>>
    >>>>>> outlineView:willDisplayOutlineCell:forTableColumn:item:
    >>>>>> Informs the delegate that an outline view is about to display a cell used to draw the expansion symbol.
    >>>>>
    >>>>> _There are no cells_ in a *view-based* outline view.
    >>>>>
    >>>>> Either on this list or in the developer forums (devforums.apple.com), Corbin Dunn acknowledged that lack of customizability of disclosure triangles is a known shortcoming with view-based outline views. He mentioned a workaround that involves looking for a subviews with a certain identifier.
    >>>>
    >>>> Please do log a bug requesting this functionality so we can expose it in an easy way.
    >>>>
    >>>> Yes, the documentation should be more clear too -- please log a bug on that also.
    >>>>
    >>>> Another alternative is to hide the disclosure triangle and add your own button that does it. It just would call expandItem or collapseItem as needed.
    >>>>
    >>>> corbin
    >>>>
    >>>>



  • Thanks for pointing this out. I added it.

    Best Regards,

    Nava Carmon,

    Moshiach Times Ltd.,

    e-mail: <ncarmon...>
    Skype: navacarmon
    Phone: +972.52.8157770

    On Jun 25, 2012, at 11:32 PM, Corbin Dunn wrote:

    > You really want to call [super didAddSubview:] in that code snippet.
    >
    > corbin
    >
    > On Jun 23, 2012, at 2:29 PM, Nava Carmon <ncarmon...> wrote:
    >
    >> Just for those who need to customize their outline view disclosure arrow:
    >> Here's the answer from SO, that worked perfectly for me.
    >>
    >> http://stackoverflow.com/questions/11127764/how-to-customize-disclosure-cel
    l-in-view-based-nsoutlineview

    >>
    >>
    >> Best Regards,
    >>
    >> Nava Carmon,
    >>
    >> Moshiach Times Ltd.,
    >>
    >> e-mail: <ncarmon...>
    >> Skype: navacarmon
    >> Phone: +972.52.8157770
    >>
    >>
    >>
    >>
    >> On Jun 21, 2012, at 7:27 PM, Nava Carmon wrote:
    >>
    >>> Thank you all for answering.
    >>>
    >>> Corbin, where is the best place to add my own disclosure button?
    >>> I believe not in the view itself, since it's indented.
    >>>
    >>> Thanks
    >>>
    >>>
    >>>
    >>> On Jun 21, 2012, at 7:25 PM, Corbin Dunn wrote:
    >>>
    >>>>
    >>>> On Jun 21, 2012, at 7:45 AM, Kyle Sluder <kyle...> wrote:
    >>>>
    >>>>> On Jun 21, 2012, at 1:22 AM, Nava Carmon <ncarmon...> wrote:
    >>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>> And this is what apple documentation says on this:
    >>>>>>
    >>>>>> outlineView:willDisplayOutlineCell:forTableColumn:item:
    >>>>>> Informs the delegate that an outline view is about to display a cell used to draw the expansion symbol.
    >>>>>
    >>>>> _There are no cells_ in a *view-based* outline view.
    >>>>>
    >>>>> Either on this list or in the developer forums (devforums.apple.com), Corbin Dunn acknowledged that lack of customizability of disclosure triangles is a known shortcoming with view-based outline views. He mentioned a workaround that involves looking for a subviews with a certain identifier.
    >>>>
    >>>> Please do log a bug requesting this functionality so we can expose it in an easy way.
    >>>>
    >>>> Yes, the documentation should be more clear too -- please log a bug on that also.
    >>>>
    >>>> Another alternative is to hide the disclosure triangle and add your own button that does it. It just would call expandItem or collapseItem as needed.
    >>>>
    >>>> corbin
    >>>>
    >>>>


    >
  • And thank you for answering my question…

    Nava

    On Jun 26, 2012, at 12:15 AM, M Larsen wrote:

    > As the guy who provided this snippet, I just want to say that it has been fixed on SO in the hope that future users of that site don't get confused.
    >
    > Thanks for catching the missing call to super.
    >
    >
    > M Larsen
    >
    >
    >
    > On 25 Jun 2012, at 22:32, Corbin Dunn wrote:
    >
    >> You really want to call [super didAddSubview:] in that code snippet.
    >>
    >> corbin
    >>
    >> On Jun 23, 2012, at 2:29 PM, Nava Carmon <ncarmon...> wrote:
    >>
    >>> Just for those who need to customize their outline view disclosure arrow:
    >>> Here's the answer from SO, that worked perfectly for me.
    >>>
    >>> http://stackoverflow.com/questions/11127764/how-to-customize-disclosure-cel
    l-in-view-based-nsoutlineview

    >>>
    >>>
    >>> Best Regards,
    >>>
    >>> Nava Carmon,
    >>>
    >>> Moshiach Times Ltd.,
    >>>
    >>> e-mail: <ncarmon...>
    >>> Skype: navacarmon
    >>> Phone: +972.52.8157770
    >>>
    >>>
    >>>
    >>>
    >>> On Jun 21, 2012, at 7:27 PM, Nava Carmon wrote:
    >>>
    >>>> Thank you all for answering.
    >>>>
    >>>> Corbin, where is the best place to add my own disclosure button?
    >>>> I believe not in the view itself, since it's indented.
    >>>>
    >>>> Thanks
    >>>>
    >>>>
    >>>>
    >>>> On Jun 21, 2012, at 7:25 PM, Corbin Dunn wrote:
    >>>>
    >>>>>
    >>>>> On Jun 21, 2012, at 7:45 AM, Kyle Sluder <kyle...> wrote:
    >>>>>
    >>>>>> On Jun 21, 2012, at 1:22 AM, Nava Carmon <ncarmon...> wrote:
    >>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>> And this is what apple documentation says on this:
    >>>>>>>
    >>>>>>> outlineView:willDisplayOutlineCell:forTableColumn:item:
    >>>>>>> Informs the delegate that an outline view is about to display a cell used to draw the expansion symbol.
    >>>>>>
    >>>>>> _There are no cells_ in a *view-based* outline view.
    >>>>>>
    >>>>>> Either on this list or in the developer forums (devforums.apple.com), Corbin Dunn acknowledged that lack of customizability of disclosure triangles is a known shortcoming with view-based outline views. He mentioned a workaround that involves looking for a subviews with a certain identifier.
    >>>>>
    >>>>> Please do log a bug requesting this functionality so we can expose it in an easy way.
    >>>>>
    >>>>> Yes, the documentation should be more clear too -- please log a bug on that also.
    >>>>>
    >>>>> Another alternative is to hide the disclosure triangle and add your own button that does it. It just would call expandItem or collapseItem as needed.
    >>>>>
    >>>>> corbin
    >>>>>
    >>>>>



    >
previous month june 2012 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