Getting pop-up form to center on monitor (1 Viewer)

I'm somewhat confused by your lengthy (but incomplete) reply so apologies if I'm missing the point here

Form positions and sizes are measured in twips and cannot currently exceed the integer limit of 32767 (approx. 22.75 inches)
Your code will give unpredictable results if you try to exceed that

I have various articles that may be helpful including:

I suggest you limit the height of continuous forms to be slightly less than the monitor height
I prefer the code in Form 3 but that won't solve your issue.
 
Apologies, I gave up on that fragment by the look of it but didn't notice it was still hiding at the end there! Thanks for taking the time anyway.

The Twips limit makes sense for the issues I'm seeing, but how does Access handle a 3 monitor setup that's wider than 22 inches? Is that why I'm seeing negative twips returned by me.Windowleft? I'm not explicitly trying to exceed 22 inches, I'm just trying to get forms to appear in relatively sensible places, e.g. if a user opens a large form and drags it to a second window, then clicks a button that causes a second small popup form to appear I'd like it to be somewhat near where they're currently working, rather than center it on a different monitor miles away,

I had wondered about trying to grab the mouse position and putting the form there but it comes back to the "how do I handle the negative twips" issue?
 
There's an alternative method which may prove useful "Sticky Forms" forms that stay where they are put ....

 
Last edited:
Having read into this a bit more I'm concerned the large 2 and 3 screen setups will cause issues with the TWIPS limits so I'm not sure I want to go the sticky forms route
 
I already knew it works. Just illustrating that it's a lot easier to hardcode the positioning versus using generic functions.
So why ask the question if you already know it works?
It has also been explained in another thread why hardcoding the values is often not the best solution
 
Hardcoding the positions might be required in certain circumstances that a generic function is unable to accurately position to the desired location.
 
Agreed that hardcoding can at times be appropriate but that doesn't explain why you asked a question that you say you already knew the answer to
 
I haven't read every post fully, but isn't a "popup" form automatically centred?

I actually don't tend to use popup forms. I use standard forms, and where I want popup functionality I wait for the form to close before continuing (ie wait for the process to realise that the popup from is no longer open) . This allows other features of the database to be used while waiting for the user to close the "popup". I also store the size and position of each form for the next time it's used.
 
I haven't read every post fully, but isn't a "popup" form automatically centred?

I actually don't tend to use popup forms. I use standard forms, and where I want popup functionality I wait for the form to close before continuing (ie wait for the process to realise that the popup from is no longer open) . This allows other features of the database to be used while waiting for the user to close the "popup". I also store the size and position of each form for the next time it's used.
I also thought popups auto centered, but found out otherwise. Maybe it has to do with screen resolutions, monitor size, Access not scaling like Excel does, etc. So I hardcode the position of my popups to accurately place them. I mostly use modal popups that forces users to close the popup before they can set focus elsewhere.
 
Last edited:
Video about autocentre. It seems to remember where the form was when you saved the design, I think. (Edit. Apparently it did misbehave but fixed now. See the video below)

 
Last edited:
On my website I have an explanation of how to build a sticky form basically a form pops up and it always covers up something you want to look at! You move it over and next time you load up the damned thing is back where it was covering up what you want to see! Is possible to make what I call a sticky form is when you've moved it it stays there see my website for links to some excellent instructions on how to do this yourself:-

 
Forms will always open where they were last saved UNLESS the AutoCenter property is set to Yes (or code is used to centre it in Form_Load event.)
This is true for both standard forms and popups.
 
Richard Rost said in the video MS fixed auto center couple years ago.
Yes, I looked at the start, and posted the link as it seemed useful but then realised it was fixed now. I just didn't edit my post. (Edit. I have edited it now)

It looks to me as if MS centered the bottom of the popup in the centre of the screen, as Richard was drawing those little rulers.
 

Users who are viewing this thread

Back
Top Bottom