Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ames!uakari.primate.wisc.edu!bin From: bin@primate.wisc.edu (Brain in Neutral) Newsgroups: comp.sys.mac.programmer Subject: Re: MacApp model dialogs (was Re: Scrolling lists in dialogs) Message-ID: <3607@uakari.primate.wisc.edu> Date: 18 Dec 90 21:53:27 GMT References: <22233@well.sf.ca.us> Sender: bin@primate.wisc.edu Reply-To: bin@primate.wisc.edu Lines: 30 From article <22233@well.sf.ca.us>, by wdh@well.sf.ca.us (Bill Hofmann): | In article <458@spam.ua.oz> jnixon@spam.ua.oz (John Nixon) writes: |>The problem is, I would also like to |>be able to centre (or center --- when in Rome ...) these ``built-in'' |>alerts/dialogs. Could some kind soul let me know if this is possible? | | Yes. The process is: | | 1. Call GetResource('ALRT', ) and save into an AlertTHndl variable | 2. The first field in an AlertTemplate is the boundsRect of the | alert window. | 3. Manipulate the boundsRect in memory to center it (screenBits.bounds, | or on a ColorQD machine, find the GDevice you want to center it on) | This boundsRect is in global coordinates. This same technique can also be used to make the alert come up right on top of your application's window, which can be more convenient if that window is not near where the aler would otherwise come up. (Test that FrontWindow() != nil, first, though and use screenBits as above if it is.) | 4. Call Alert() or NoteAlert(), etc. | 5. Since Alert... calls GetResource('ALRT',), it'll get your | manipulated data. | 6. That's all there is. Don't mark the resource changed. You might also call ReleaseResource() since you don't need it anymore. -- Paul DuBois dubois@primate.wisc.edu