Re: NSOutlineView & NSTableView setEnabled:NO not working?
Re: NSOutlineView & NSTableView setEnabled:NO not working?
- Subject: Re: NSOutlineView & NSTableView setEnabled:NO not working?
- From: Robb Olsen-Albright <email@hidden>
- Date: Thu, 2 Nov 2006 09:06:47 -0800
On Nov 1, 2006, at 7:41 PM, Ron Lue-Sang <email@hidden> 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
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden