• Welcome to PlanetSquires Forums.
 

WinFBE 2.1.7 - Dual Monitor Form Screen Position (Form Windows State Normal)

Started by SeaVipe, December 29, 2020, 03:46:48 PM

Previous topic - Next topic

SeaVipe

Hi Paul, I hope you and your family had a safe and happy Christmas!
I'm sure this topic has been discussed before but my searches have not found a resolution.
My issue is that I cannot get a child form to centre (or position) over a parent form when the parent form is displayed on a second (IE not #1) monitor. Child form Properties, when set to Center Parent will position the Child hard right on the #1 monitor not centred over the Parent on monitor #2 (to my right). Also, the Left when established in FormClosing is much different than the Left when displayed on the console using Function frmPopup_move(...)
? frmPopup.Left

In this case, the left, when the popup form is dragged to the #1 monitor displays large negative numbers.
My expectation would be that the #1 monitor left would = 0 and the #2 monitor left (to the right of the #1 monitor) would = something slightly greater than 0 plus the width of the #2 monitor.
As a workaround, I simply read an ini file with the popup form's Left set manually (which is a value as per my "expectations" above). I haven't yet looked through wfxForm.
Here is the console display with the form hardcoded to Left = 2300 (2 calls to Move and without dragging the form ):
Left = -2400
immediately followed by
Left = 380
Can't seem to find any FB comparable to the VB6 Screen.Width etc.
Clive Richey

Paul Squires

Thanks Clive, hope you're doing well also and enjoying the holidays!

I can confirm the behaviour that you are seeing.

I am using code from Jose's Afx library to help determine the display position of the popup window. The code makes a call to SystemParametersInfo with the SPI_GETWORKAREA flag. This gets the screen area that should be used for calculating the position. The "problem" is that the SPI_GETWORKAREA flag always uses the primary display. I will have to investigate a more robust way of handling the multiple setup probably utilizing calls to MonitorFromRect and GetMonitorInfo etc.

I'll investigate a fix and hopefully have something for the upcoming release.

Thanks!
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer