Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!ncar!ames!pasteur!helios.ee.lbl.gov!ux1.lbl.gov!beard From: beard@ux1.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: Color windows in LSC Message-ID: <2431@helios.ee.lbl.gov> Date: 18 Apr 89 08:48:25 GMT References: <1360@ndmath.UUCP> Sender: usenet@helios.ee.lbl.gov Reply-To: beard@ux1.lbl.gov (Patrick C Beard) Distribution: na Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 25 In article <1360@ndmath.UUCP> hardie@ndmath.UUCP (Hardie Tankersley) writes: >I'm having trouble getting to my window's portPixMap with >(imageWindow->portPixMap) >and variations on this theme. The window is declared 'WindowPtr imageWindow', >so maybe it doesn't treat it like a color window. But LSC refuses to let me >declare a CWindowPtr or CWindowRecord. The only related color structure LSC >seems to know about is a CGrafPort. But it won't let me cast my window pointer >dereferenced into >a CGrafPort. (i.e. ((CGrafPtr)*imageWindow)->portPixMap). > >Can someone please help me find my poor lost portPixMap? > The problem is in your example: ((CGrafPtr)*imageWindow)->portPixMap can't possibly work. The correct cast is: (*(CGrafPtr)imageWindow).portPixMap, or ((CGrafPtr)imageWindow)->portPixMap. You are right in that you do need to cast to a CGrafPtr, but you better be sure that you create the window with NewCWindow or GetNewCWindow or this cast will produce nonsense. __________________ Patrick Beard PCBeard@lbl.gov BSI, Berkeley, CA ___________________