Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!kth.se!cyklop.nada.kth.se!news From: d88-jwa@dront.nada.kth.se (Jon W{tte) Newsgroups: comp.sys.mac.programmer Subject: Re: Remembering window locations Message-ID: <1991Jan20.092039.13132@nada.kth.se> Date: 20 Jan 91 09:20:39 GMT References: Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 44 In article es1o+@andrew.cmu.edu (Eric Mitchell Snider) writes: >locations of windows. The problem I'm having is I don't know how to >check if the window will appear on the screen. Suppose someone with a >big monitor drags the window way into the lower right corner. If >someone else with a small screen runs the program and it tries to You check that the top left corner is within GetGrayRgn ( ). Try: Rect * * thePos ; RgnHandle theFoo ; /* Read in the saved rect */ thePos = ( Rect * * ) GetResource ( 'Rect' , 128 ) ; /* Construct the screen outline minus a little slop in the lower right parts */ theFoo = GetGrayRgn ( ) ; HandToHand ( theFoo ) ; InsetRgn ( theFoo , 5 , 5 ) ; OffsetRgn ( theFoo , -5 , -5 ) ; /* Check for sanity */ if ( PtInRgn ( * ( Point * ) * theRect , theFoo ) ) { /* Use * * theRect */ } else { /* Use your default - screenBits . bounds maybe. GrayRgn . rgnbBBox covers _all_ screens, and thus is less optimal ;-) */ } /* Be nice to memory */ DisposHandle ( theFoo ) ; ReleaseResource ( theRect ) ; Happy hacking, h+ Jon W{tte, Stockholm, Sweden, h+@nada.kth.se :: This article is fake. If you take it for real, the _REAL_ :: Jon W{tte will sue you for slander. So there ! Nyah ! :-)