Re: 2 questions on Cocoa design and "expected" behavior
Re: 2 questions on Cocoa design and "expected" behavior
- Subject: Re: 2 questions on Cocoa design and "expected" behavior
- From: Stéphane Sudre <email@hidden>
- Date: Thu, 11 Sep 2003 00:46:20 +0200
On mercredi, septembre 10, 2003, at 07:52 PM, Neil Earnshaw wrote:
1) Why is an Utility window always receiving the windowWillClose
notification even when it has never been displayed?
I would guess that when it is loaded from the nib it has the chance to
allocate resources, whether or not it's been displayed. It gets
windowWillClose so that it can release those resources. (That's just
a guess; no-one else responded so I thought I'd have a stab.)
That's the job of dealloc.
2) Why is the management of selection in NSBrowser completely
different from the one of the other widgets like NSTableView,
NSOutlineView? Mainly, why is not the delegate able to manage the
selection?
The delegate has a chance to influence selection. Check out the
delegate methods, especially:
- (BOOL)browser:(NSBrowser *)sender selectRow:(int)row
inColumn:(int)column
If the delegate implements this then the browser will hand full
control of selection over to it. You can also use the NSBrowser
method:
- (void)selectRow:(int)row inColumn:(int)column
To explicitly set the selected cell.
You can also play about with the individual NSBrowserCells as well.
Remember, they inherit from NSCell which provides a ton of methods.
Have you got CocoaBrowser or DocoaBrowser? They are excellent for
trawling through a class's methods and other documentation to find out
what's available. Both are free downloads. (Big thanks to both
developers!)
Contrary to what one could think, this method is never called when you
would suppose it to be. It's only called when the user use another
specific method. To handle selection you have to use the action method.
Therefore my question.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.