monching@quiche.cs.mcgill.ca (Patrick WONG) (04/12/90)
On the subject of centering dialogs, how would one center the toolbox
dialogs like SFGetFile and SFPutFile, etc ...
We don't know the size of the dialog and we must give a top left corner
before hand. Seems like you have to guessimate the value for a specific
screen. Is there a better way?
--
patrick wong | McGill University
monching@quiche.cs.mcgill.ca | School of Computer Science
| Montreal, Quebec
aries@rhi.hi.is (Reynir Hugason) (04/14/90)
monching@quiche.cs.mcgill.ca (Patrick WONG) writes: >On the subject of centering dialogs, how would one center the toolbox >dialogs like SFGetFile and SFPutFile, etc ... >We don't know the size of the dialog and we must give a top left corner >before hand. Seems like you have to guessimate the value for a specific >screen. Is there a better way? Sure is. But to begin with both the SFGetFile and SFPutFile are usually _not_ centered, _ever_. I for one have never seen that done. The ususal practice is to stick it at (80,80) (topLeft that is) and just leave there. But if you _really_ want to you can get the dialogs boundsRect and calculate the topLeft from there. To get the boundsRect you could use the following procedure: PROCEDURE GetDialogRect(dlgID: INTEGER; VAR boundsRect: Rect); VAR tempDlg: DialogPtr; BEGIN tempDlg:=GetNewDialog(dlgID, NIL Pointer(-1)); boundsRect:=tempDlg^.portRect; DisposDialog(tempDlg); END; Well, that's all you have to do really ;-) ============================================================================== Mimir R. (aries@rhi.hi.is) | A program is like a nose. Taeknigardur, Dunhaga 5 | Sometimes it runs, sometimes it blows. IS-105, Reykjavik | ICELAND | DISCLAIMER: Who me?! ==============================================================================