On Dec 23, 2009, at 03:15, Jean-Daniel Dupas wrote:

> Le 23 déc. 2009 à 12:06, Gregory Weston a écrit :
> 
>> Rick Mann wrote:
>> 
>>> I'm not against the notification, I just think NSView should have an active 
>>> property. Views do become inactive (look at any well-designed control).
>> 
>> Did you happen to have an 'a-ha' moment when you typed that sentence? 
>> "Views" don't generally have an active/inactive state. Controls, which are a 
>> special case of view, do. So have you considered making your custom view an 
>> NSControl instead of a simple NSView?
>> 
>> That's the thing, you see. "Inactive" means the user can't interact with it. 
>> But the user can't interact with a view that's not a control anyway, so the 
>> state has no meaning.
> 
> and 'active' is called 'enabled' in Cocoa.

Except that it's more complicated than that, not entirely to Cocoa's glory.

The first responder in an active window loses what you might call "focus" when 
the window becomes inactive. It *also* by default loses the ability to respond 
to "first" mouse clicks, except when it doesn't (if the default behavior is 
overridden). 

If the view is a control, it may have an enabled-but-inactive appearance 
(usually, the color is removed or dimmed, such as the selection turning gray, 
or a NSTableView source list changing from blue to gray) that's different from 
their disabled appearance (disabled controls don't have selections at all). The 
appearance may or may not be matched to the first-responder/first-mouse-click 
state, but that's not consistent behavior nor is it enforced by the frameworks. 
And, of course, a control may be disabled in an active window for other 
reasons. And, of course, custom non-control views may choose to represent 
themselves differently in an inactive window, following the model (well, one of 
the models) provided by controls, or not.

There's no *formal* inactive state for views, although the state is often 
implemented informally, with greater or lesser consistency depending on the 
thoroughness of the developer and the state of advancement of the frameworks. 
(For example, IIRC the ability for a NSTableView to show a either visually 
inactive state or a disabled state is fairly recent.)

So, the answer is still that windows become inactive, but views (formally) do 
not. What views do (informally) is decided on a case-by-case basis.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to