Enabling/Disabling an NSTableView in an NSPanel

  • Hello,

    I have a pretty simple NSPanel that contains two NSTableViews, one which is always enabled, and one that needs to become enabled/disabled when a checkbox is clicked. I've got a simple NSWindowController subclass (MyPanelController) that is set as the dataSource and delegate to the two tables.

    the table-controlling checkbox is initially unchecked, and I'm doing a [secondTable setEnabled:NO] in my awakeFromNib: in MyPanelController (since I can't find an "enabled" checkbox for NSTableView objects in IB). But while secondTable doesn't draw any items in its box when "disabled", when I click on it, it draws a focus ring, and it's part of the tab traversal.

    Enabling/disabling tables and lists seems like such a basic operation. (What I'd really like is for a disabled NSTableView to draw its items greyed, but...). What is the right way to disable NSTableViews so they remove themselves out of the tab traversal path?

    Thanks
    Jeffrey Johnson
    Macintosh Development
    Wavefunction, Inc.
  • Not sure if this solves your problem, but NSTableView does have an
    enabled binding that is available in IB. Keep in mind that if you
    just click on the tableview, the inspector actually shows the
    NSScrollView (which doesn't have that binding). You need to double-
    click to get at the tableview itself.

    Hank

    On Oct 16, 2006, at 10:34 AM, Jeffrey Johnson wrote:

    > Hello,
    >
    > I have a pretty simple NSPanel that contains two NSTableViews, one
    > which is always enabled, and one that needs to become enabled/
    > disabled when a checkbox is clicked. I've got a simple
    > NSWindowController subclass (MyPanelController) that is set as the
    > dataSource and delegate to the two tables.
    >
    > the table-controlling checkbox is initially unchecked, and I'm
    > doing a [secondTable setEnabled:NO] in my awakeFromNib: in
    > MyPanelController (since I can't find an "enabled" checkbox for
    > NSTableView objects in IB). But while secondTable doesn't draw any
    > items in its box when "disabled", when I click on it, it draws a
    > focus ring, and it's part of the tab traversal.
    >
    > Enabling/disabling tables and lists seems like such a basic
    > operation. (What I'd really like is for a disabled NSTableView to
    > draw its items greyed, but...). What is the right way to disable
    > NSTableViews so they remove themselves out of the tab traversal path?
    >
    >
    > Thanks
    > Jeffrey Johnson
    > Macintosh Development
    > Wavefunction, Inc.
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/<hankh...>
    >
    > This email sent to <hankh...>
    >

    Hank Heijink
    www.hankheijink.com
    <hankh...>
previous month october 2006 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