NSOutlineView & NSTableView setEnabled:NO not working?

  • I'm trying to disable outline views & table views in dialogs, but
    sending setEnabled:NO to either (via an outlet in a controller) seems
    to have no effect (besides setting the internal state, so that
    sending isEnabled returns NO). Mouse clicks in the column headers or
    cell are are still acted upon.

    From NSControl docs:
    Sets whether the receiver (and its cell) reacts to mouse events.

    - (void)setEnabled:(BOOL)flag

    Parameters
    flag
    YES if you want the receiver to react to mouse events; otherwise, NO.

    and NSOutlineView & NSTableView both inherit from NSControl, and I
    don't see any reference in their docs to why this wouldn't work.

    I did search the archives and Google, but didn't turn up anything
    useful. there are some references to disabling custom cells in a data
    view but nothing about why you can't disable the whole control.

    I did just deal with NSTextView not disabling, and there is a tech Q
    & A for that, but nothing about outline/table.

    Anybody have an answer or ideas?

    thanks,

    robb olsen-albright
  • On Nov 1, 2006, at 2:29 PM, Robb Olsen-Albright wrote:

    > I'm trying to disable outline views & table views in dialogs, but
    > sending setEnabled:NO to either (via an outlet in a controller)
    > seems to have no effect (besides setting the internal state, so
    > that sending isEnabled returns NO). Mouse clicks in the column
    > headers or cell are are still acted upon.

    [...]

    > I did search the archives and Google, but didn't turn up anything
    > useful.

    http://lists.apple.com/archives/cocoa-dev/2006/Mar/msg01027.html

    Jim
  • > Date: Wed, 1 Nov 2006 11:29:21 -0800
    > From: Robb Olsen-Albright <rolsenalbright...>
    > Subject: NSOutlineView & NSTableView setEnabled:NO not working?
    > To: <cocoa-dev...>
    > Message-ID: <AA3E424C-6787-46E9-9EF2-D10BF3A76388...>
    > Content-Type: text/plain;    charset=US-ASCII;    delsp=yes;    format=flowed
    >
    > I'm trying to disable outline views & table views in dialogs, but
    > sending setEnabled:NO to either (via an outlet in a controller) seems
    > to have no effect (besides setting the internal state, so that
    > sending isEnabled returns NO). Mouse clicks in the column headers or
    > cell are are still acted upon.
    >
    > From NSControl docs:
    > Sets whether the receiver (and its cell) reacts to mouse events.
    >
    > - (void)setEnabled:(BOOL)flag
    >
    > Parameters
    > flag
    > YES if you want the receiver to react to mouse events; otherwise, NO.
    >
    >
    >
    > and NSOutlineView & NSTableView both inherit from NSControl, and I
    > don't see any reference in their docs to why this wouldn't work.
    >
    >
    > I did search the archives and Google, but didn't turn up anything
    > useful. there are some references to disabling custom cells in a data
    > view but nothing about why you can't disable the whole control.
    >
    > I did just deal with NSTextView not disabling, and there is a tech Q
    > & A for that, but nothing about outline/table.
    >
    > Anybody have an answer or ideas?
    >
    >
    > thanks,
    >
    > robb olsen-albright
    >

    Are you sure you're messaging the tableview and not its scroll view?
    If you set up the outlet in IB, you might have accidentally set your
    file's owner's outlet to the tableview's scrollview instead of the
    tableview itself.
  • On Nov 1, 2006, at 7:41 PM, Ron Lue-Sang <luesang...> wrote:

    >> I'm trying to disable outline views & table views in dialogs, but
    >> sending setEnabled:NO to either (via an outlet in a controller) seems
    >> to have no effect (besides setting the internal state, so that
    >> sending isEnabled returns NO). Mouse clicks in the column headers or
    >> cell are are still acted upon.
    >>
    >> From NSControl docs:
    >> Sets whether the receiver (and its cell) reacts to mouse events.
    >>
    >> - (void)setEnabled:(BOOL)flag
    >>
    >> Parameters
    >> flag
    >> YES if you want the receiver to react to mouse events; otherwise, NO.
    >>
    >>
    >>
    >> and NSOutlineView & NSTableView both inherit from NSControl, and I
    >> don't see any reference in their docs to why this wouldn't work.
    >>
    >>
    >> I did search the archives and Google, but didn't turn up anything
    >> useful. there are some references to disabling custom cells in a data
    >> view but nothing about why you can't disable the whole control.
    >>
    >> I did just deal with NSTextView not disabling, and there is a tech Q
    >> & A for that, but nothing about outline/table.
    >>
    >> Anybody have an answer or ideas?
    >>
    >>
    >> thanks,
    >>
    >> robb olsen-albright
    >>
    >
    > Are you sure you're messaging the tableview and not its scroll view?
    > If you set up the outlet in IB, you might have accidentally set your
    > file's owner's outlet to the tableview's scrollview instead of the
    > tableview itself.

    Yes, I'm sure I'm sending to the NSTableView (and the NSOutlineView),
    not the NSScrollView.

    There was a previous response that indicated that these controls do
    not disable as of Tiger, so in the short term, I'm just disabling all
    the cells with:

      NSArray* columns = [tableView tableColumns];
      NSEnumerator* columnsEnumerator = [columns objectEnumerator];
      NSTableColumn* aColumn = nil;
      while ((aColumn = [columnsEnumerator nextObject]))
      {
      [[aColumn headerCell] setEnabled:enabled];
      [[aColumn dataCell] setEnabled:enabled];
      }

    This does take care of not allowing user to change things in the
    table, but it still allows row selection, etc. so it's not perfect.
    (I know I can handle the delegate message to disable selection, I'll
    probably add that later)

    -robb
previous month november 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      
Go to today