On 19 May 2012, at 2:29 PM, Jason Teagle wrote:

> I realise now that NSView is fairly analogous to JPanel in Java, and thus is 
> not likely to be a top-level window within an app.

Conceptual note: The Xerox Star, Apple Lisa, and Apple Macintosh had windows: 
Independent, top-level containers that can be moved independently and freely 
positioned, even over each other.

Overlapping, independently-positionable windows, with mid-'80s technology, 
involved either a superfast (for the time) central processor (Xerox), or some 
very clever programming (Apple). It was a hard problem. 

Microsoft solved the problem by declaring any _non_-overlapping rectangle tiled 
on the screen to be a "window." QED. It eventually got z-ordered clipping down, 
and modern Windows permits objects to be moved freely, but that's not how it 
started. As I understand it, any discrete thing on the screen is still called a 
"window."

In Mac OS, views are _never_ windows, nor windows views. (And screens aren't 
windows, and screen spaces aren't screens.) Subclasses of NSViews are 
interesting because they alone can draw, and respond to events, but they can't 
have any presence on the screen, or role in event handling, without an 
enclosing NSWindow. NSWindow isn't interesting, because its role in an 
application is strictly stereotyped; you can have a long career in Mac 
programming without ever subclassing NSWindow or even thinking much about how 
it works.

A view is not merely "[un]likely to be a top-level window," it is impossible. 
The two can't be interchanged. 

Slow down on your (apparent) assumption that the Windows Way (or even the iOS 
Way, though it's closer) is how Mac OS works. Go back to the Programmer's 
Guides, and don't rush in before you have the concepts.

        — F

-- 
Fritz Anderson -- Xcode 4 Unleashed, now in stores -- 
<http://x4u.manoverboard.org/>


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to