Table View Headers Programatically

  • Is there a way to programatically set the flag for "display column
    headers" on a table view/outline view? I haven't been able to figure
    out how to duplicate this. I'm laying out the view programatically
    (doing it with IB is not an option, for the circumstances I'm dealing
    with), and thus need to know how to do everything programatically, but
    this is tripping me up...

    Thanks,

    Clark
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • On Wednesday, January 22, 2003, at 08:14 PM,
    <cocoa-dev-request...> wrote:

    > Is there a way to programatically set the flag for "display column
    > headers" on a table view/outline view? I haven't been able to figure
    > out how to duplicate this. I'm laying out the view programatically
    > (doing it with IB is not an option, for the circumstances I'm dealing
    > with), and thus need to know how to do everything programatically, but
    > this is tripping me up...

    If you wanted to set up a table view like the one from the IB palette,
    with column headers showing, I think you would actually need to
    explicitly set up an NSTableView (inside an NSScrollView) along with an
    NSTableHeaderView and a corner view, since those two auxiliary views
    aren't actually subviews of the table view, but rather the scroll view.
      I believe if you just do an [[NSTableView alloc] initWithFrame:frame]
    and stick it in a scroll view, it won't have a header view by default.
    If you wanted to be able to toggle this at runtime, I'm not sure if
    just calling setHeaderView: and setCornerView: would be smart enough to
    insert the new views correctly in the hierarchy, or if you'd have to
    wedge it in there yourself.

    --
    Brian Webster
    <bwebster...>
    http://homepage.mac.com/bwebster
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • Sounds like work, to me. :) I will go about doing that then. The
    setHeaderView: and setCornerView: methods do not do this. They are in
    the hodgepodge of things that I'm working with currently, but they
    don't want to work, so I will try your method.

    Thanks,

    Clark

    On Wednesday, January 22, 2003, at 09:33  PM, Brian Webster wrote:

    > On Wednesday, January 22, 2003, at 08:14 PM,
    > <cocoa-dev-request...> wrote:
    >
    >> Is there a way to programatically set the flag for "display column
    >> headers" on a table view/outline view? I haven't been able to figure
    >> out how to duplicate this. I'm laying out the view programatically
    >> (doing it with IB is not an option, for the circumstances I'm dealing
    >> with), and thus need to know how to do everything programatically, but
    >> this is tripping me up...
    >
    > If you wanted to set up a table view like the one from the IB palette,
    > with column headers showing, I think you would actually need to
    > explicitly set up an NSTableView (inside an NSScrollView) along with
    > an NSTableHeaderView and a corner view, since those two auxiliary
    > views aren't actually subviews of the table view, but rather the
    > scroll view.  I believe if you just do an [[NSTableView alloc]
    > initWithFrame:frame] and stick it in a scroll view, it won't have a
    > header view by default.  If you wanted to be able to toggle this at
    > runtime, I'm not sure if just calling setHeaderView: and
    > setCornerView: would be smart enough to insert the new views correctly
    > in the hierarchy, or if you'd have to wedge it in there yourself.
    >
    > --
    > Brian Webster
    > <bwebster...>
    > http://homepage.mac.com/bwebster
    > _______________________________________________
    > cocoa-dev mailing list | <cocoa-dev...>
    > Help/Unsubscribe/Archives:
    > http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    > Do not post admin requests to the list. They will be ignored.
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • On Wednesday, January 22, 2003, at 04:58  PM, Clark Mueller wrote:
    > Is there a way to programatically set the flag for "display column
    > headers" on a table view/outline view? I haven't been able to figure
    > out how to duplicate this. I'm laying out the view programatically
    > (doing it with IB is not an option, for the circumstances I'm dealing
    > with), and thus need to know how to do everything programatically, but
    > this is tripping me up...

    You might check out this tutorial by Mike Beam on the O'Reilly site:

    http://www.macdevcenter.com/pub/a/mac/2001/09/17/cocoa.html

    It's done in the context of configurable preferences, but I
    believe there is some code in there that programmatically
    manages an NSTableView. I'm not sure if this is exactly
    what you're looking for, but it might help or point you
    in the right direction...

    -daniel
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • First, in response to Mr. Hedrick, that does show me some things, but
    not what I'm looking for. I need to have an example that doesn't use IB
    at all, more than anything.

    As for arranging things into an NSScrollView with the header view and
    so forth, I haven't gotten very far, but it *looks* to me like the
    column headers are part of the NSTableColumn; unfortunately, I haven't
    figured out how to make them be shown. I can't tell exactly whether IB
    then is splitting up and nesting the header cell inside the table
    column, or if something else is going on, but I'm pushing ahead slowly
    with it. I certainly welcome more suggestions! Perhaps if there's
    someone on the IB team at Apple willing to tell me how IB does this.
    That is *precisely* the behaviour I seek to mimic, actually. In a very
    different context, but my desire is to construct a table view from the
    appropriate components, and then have it be draggable in a view. I can
    deal with the draggable in a view part, but I haven't figured out how
    to properly construct the table yet.

    Thanks for the suggestions - keep 'em coming,

    Clark Mueller
    <cpmueller...>

    On Wednesday, January 22, 2003, at 09:48  PM, Clark Mueller wrote:

    > Sounds like work, to me. :) I will go about doing that then. The
    > setHeaderView: and setCornerView: methods do not do this. They are in
    > the hodgepodge of things that I'm working with currently, but they
    > don't want to work, so I will try your method.
    >
    > Thanks,
    >
    > Clark
    >
    > On Wednesday, January 22, 2003, at 09:33  PM, Brian Webster wrote:
    >
    >> On Wednesday, January 22, 2003, at 08:14 PM,
    >> <cocoa-dev-request...> wrote:
    >>
    >>> Is there a way to programatically set the flag for "display column
    >>> headers" on a table view/outline view? I haven't been able to figure
    >>> out how to duplicate this. I'm laying out the view programatically
    >>> (doing it with IB is not an option, for the circumstances I'm dealing
    >>> with), and thus need to know how to do everything programatically,
    >>> but
    >>> this is tripping me up...
    >>
    >> If you wanted to set up a table view like the one from the IB
    >> palette, with column headers showing, I think you would actually need
    >> to explicitly set up an NSTableView (inside an NSScrollView) along
    >> with an NSTableHeaderView and a corner view, since those two
    >> auxiliary views aren't actually subviews of the table view, but
    >> rather the scroll view.  I believe if you just do an [[NSTableView
    >> alloc] initWithFrame:frame] and stick it in a scroll view, it won't
    >> have a header view by default.  If you wanted to be able to toggle
    >> this at runtime, I'm not sure if just calling setHeaderView: and
    >> setCornerView: would be smart enough to insert the new views
    >> correctly in the hierarchy, or if you'd have to wedge it in there
    >> yourself.
    >>
    >> --
    >> Brian Webster
    >> <bwebster...>
    >> http://homepage.mac.com/bwebster
    >> _______________________________________________
    >> cocoa-dev mailing list | <cocoa-dev...>
    >> Help/Unsubscribe/Archives:
    >> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    >> Do not post admin requests to the list. They will be ignored.
    > _______________________________________________
    > cocoa-dev mailing list | <cocoa-dev...>
    > Help/Unsubscribe/Archives:
    > http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    > Do not post admin requests to the list. They will be ignored.
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
previous month january 2003 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 31    
Go to today