Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sunybcs!boulder!pratt From: pratt@boulder.Colorado.EDU (Jonathan Pratt) Newsgroups: comp.sys.mac.programmer Subject: Re: Centering Alerts Message-ID: <14946@boulder.Colorado.EDU> Date: 16 Dec 89 02:59:52 GMT References: <7454@hubcap.clemson.edu> <22417@ut-emx.UUCP> Sender: news@boulder.Colorado.EDU Reply-To: pratt@boulder.Colorado.EDU (Jonathan Pratt) Distribution: usa Organization: University of Colorado, Boulder Lines: 43 In article <22417@ut-emx.UUCP> rdd@walt.cc.utexas.edu (Robert Dorsett) writes: >Is there an elegant (i.e., easy) way to center *alerts* on a screen? I mean, >apart from writing an alert-simulator? > > > > >Robert Dorsett >Internet: rdd@rascal.ics.utexas.edu >UUCP: ...cs.utexas.edu!rascal.ics.utexas.edu!rdd /* Center a rectangle in middle of main screen. */ static void CenterRect(r) register Rect *r; { int h,v; OffsetRect(r, screenBits.bounds.left + screenBits.bounds.right - r->left-r->ri ght >> 1, screenBits.bounds.top + screenBits.bounds.bottom - r->top -r->bo ttom >> 1 ); } int StdAlert(theID) int theID; { AlertTHndl a; if ( a=(AlertTHndl)GetResource('ALRT',theID) ) { CenterRect(&(**(a)).boundsRect); return Alert(theID,MyFilter); } SysBeep(0); return(OK); } Something like this has worked for me. Jonathan /* Jonathan Pratt Internet: pratt@boulder.colorado.edu * * Campus Box 525 uucp: ..!{ncar|nbires}!boulder!pratt * * University of Colorado * * Boulder, CO 80309 Phone: (303) 492-4293 */