Jump to content

Making A Window Appear in the middle of Screen

This topic is 6488 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi All

Been extending my mathematics over the last day, and thought those of you working at a similar level of development (ie. very basic) might like this little operation to get your windows to pop-up in the middle of a user's screen.

When using the MOVE/RESIZE WINDOW script step, add the following calculations in the dialogue box;

- select 'specify' for both 'distance from left' and 'from top'

In the calculation, enter:

(Get ( ScreenWidth )-Get ( WindowWidth )) / 2

(for the 'from left' option)


(Get ( ScreenHeight )-Get ( WindowHeight )) / 2

(for the 'from top' option)

In addition, I created two custom functions to return these calculations whenever I need them

Window to Centre Height


Window to Centre Width

Then when working with the 'specify' option, you can just call the custom function for each option.

Seems to work OK.


FileMaker Version: Dev 7

Platform: Mac OS X Panther

Link to comment
Share on other sites

Hi Andy,

Thanks for the ideas! smile.gif

One thing however ... I've found that I don't need (or really want) the screen size, but rather want what FM refers to as the desktop size. Why? Because the screen size doesn't take into account whether someone's task bar is displayed. And if you want a 'full window,' part of it may be hidden under a task bar. Or if their task bar is displayed on the side, it won't center perfectly.

By using Get (WindowDesktopHeight) instead, it centers no matter whether their task bar is showing - or whether they have dragged it to two row-height or placed it on the sides. So I use WindowDesktop for determining both height and width available for my windows placement. At least that's what my tests indicate. But I'm still just a newbie with FM7. crazy.gif

FileMaker Version: Dev 7

Platform: Windows XP

Link to comment
Share on other sites


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.