Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!linac!att!cbnewsm!cbnewsk!ech From: ech@cbnewsk.att.com (ned.horvath) Newsgroups: comp.sys.mac.programmer Subject: Re: window Message-ID: <1991May9.214313.11735@cbnewsk.att.com> Date: 9 May 91 21:43:13 GMT References: <1991May9.130911.9763@umiami.ir.miami.edu> Organization: AT&T Bell Laboratories Lines: 27 From article <1991May9.130911.9763@umiami.ir.miami.edu>, by dweisman@umiami.ir.miami.edu (Ordinary Man): > Yeah, that *IS* the correct way to get at the WindowRecord of a window. I think > the correct way to typecast is: > > var windRec:WindowRecord; > > begin > ... > windRec:=WindowPeek(yourWindowPtr); > ... > end; > > You could also pass a pointer to the window's record when it gets created using > (Get)NewWindow and setting the wStorage parameter to your window record. > The Window Manager function FrontWindow will return the currently active window > (i.e. if myWindow=FrontWindow then ...). Not quite: a WindowPeek is a pointer to a WindowRecord, so you'd need something like windRec := WindowPeek(yourWindowPtr)^; Similarly, FrontWindow returns a WindowPtr (which you can convert to a WindowPeek), not a WindowRecord. Beware: FrontWindow returns the frontmost VISIBLE window: it may return nil. -- =Ned Horvath= ehorvath@attmail.com