Re: Are views active or inactive?
Re: Are views active or inactive?
- Subject: Re: Are views active or inactive?
- From: Gregory Weston <email@hidden>
- Date: Wed, 23 Dec 2009 16:26:11 -0500
On Dec 23, 2009, at 2:20 PM, Rick Mann wrote:
>
> On Dec 23, 2009, at 03:06:58, Gregory Weston wrote:
>
>> 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.
>
> On the contrary, users can interact with an inactive control. They can't interact with a disabled control. Consider a scroll bar. It can draw in an inactive state (not blue), but you can still interact with it by sending the window scroll events (something I'm unconvinced you should be able to do, but you can, and it proves convenient).
I'd point out that you've kind of gone off your own point here. Quibbling about what it means to interact with a control aside, you're still talking about a *control* having an inactive state, not a (generic) view.
> In my case, it's a drawing canvas. However, the active drawing tool should not draw when the view is inactive (not frontmost). Since the tool is a singleton object in the app used by many views, it's important to be able to make the distinction. I suppose I could subclass NSControl, but this strikes me as inelegant (and I don't know that it has active/inactive state anyway).
With this expanded explanation, I think the correct answer is that you're going about it the wrong way. It's not a normal Mac HI behavior for a drawing canvas to draw itself differently as a side-effect of its window being inactive.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden