Path: utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!uwvax!oddjob!tank!nucsrl!bob From: bob@eecs.nwu.edu (Bob Hablutzel) Newsgroups: comp.sys.mac.programmer Subject: Re: Centering Dialogs Message-ID: <10050018@eecs.nwu.edu> Date: 20 Sep 88 12:55:47 GMT References:Organization: Northwestern U, Evanston IL, USA Lines: 45 > Centering alert and dialog boxes is relative straight forward > on a single screen system, but what do you do when there are two or > more screens connected to the system? I tried to find some mention > of how this should be handled in IM, but did not. > There are several ways this could be done: (1) Center over > ScreenBits.Bounds, which would probably put the dialog between screens. > (2) Always center on the main screen (the one with the menu bar). (3) > Try to locate the screen with the frontmost window, and center on it. > (4) Center the dialog on the screen that the cursor is currently > pointing on. > The problem is that I only have one screen, and want my programs > to work correctly on bigger systems. I have already implemented the > fourth (4) method. Anyone think that it should be done differently or > have any other methods? To my mind, (1) is the best. This does _not_ center the dialog between screens. I've got two screens on my Mac, and I just wrote the following code to test my theory: Program Test; Uses MemTypes, QuickDraw; Var OurPort : GrafPort; Begin InitGraf( @thePort ); OpenPort( @OurPort ); EraseRect( OurPort.PortRect.Bounds ); End. This code erases _only_ the screen with the menu bar. (This is true even if that screen is not the startup screen). Therefore centering on screenBits.Bounds (which is the same as OurPort.PortRect.Bounds in this example) will give the desired results. BTW - this seems to be what most people are doing. Whether this is some grand scheme I am unaware of, or happy accident, I cannot say. I suspect happy accidents, however. > Rob Johnston. > ---------- Bob Hablutzel BOB@NUACC.ACNS.NWU.EDU Disclaimer: Programming is an empirical science.