Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!brunix!omh From: omh@cs.brown.edu (Owen M. Hartnett) Newsgroups: comp.sys.mac.programmer Subject: Re: when to use NewCWindow? Message-ID: <68833@brunix.UUCP> Date: 17 Mar 91 05:56:39 GMT References: <12364@pt.cs.cmu.edu> Sender: news@brunix.UUCP Reply-To: omh@cs.brown.edu (Owen M. Hartnett) Organization: Brown University Department of Computer Science Lines: 30 In article <12364@pt.cs.cmu.edu> hairston@henry.ECE.CMU.EDU (David Hairston) writes: > >how do you determine when it is absolutely safe to use NewCWindow >as opposed to NewWindow? i'm confused by the all things you can >test and their implications (i.e. sys environs and gdFlags, etc.). >i'd like to use NewCWindow unless the hardware absolutely prohibits >this, in which case my newWindow() function would use NewWindow >instead. The new Gestalt function would let you test for color QD. However, this should be one of those things that *you shouldn't have to test* - but you probably do. Why? a CWindow is just like a Window except that it has more fields. NewCWindow on a non color QD machine should just return a CWindow with the extra fields. It can't do anything with them, but at least it won't crash because of a NewCWindow call and it means that the programmer won't have to put in conditional code if the user has colorQD or not just to support having color in his window. I'm not saying that NewCWindow works like this, or that it doesn't work like this (I haven't tried it on a non color machine) but this is how it should work. -Owen Owen Hartnett omh@cs.brown.edu.CSNET Brown University Computer Science omh@cs.brown.edu uunet!brunix!omh "Don't wait up for me tonight because I won't be home for a month."