Alaska Software Inc. - AppDeskTop() and multiple monitors.
Username: Password:
AuthorTopic: AppDeskTop() and multiple monitors.
Itai Ben-ArtziAppDeskTop() and multiple monitors.
on Sun, 12 Jul 2020 00:00:20 -0700
Is it possible to change AppDesktop() to a secondary monitor if a user
moves the main application to that monitor?  How?
Andreas Gehrs-Pahl
Re: AppDeskTop() and multiple monitors.
on Sun, 12 Jul 2020 13:01:01 -0400
Itai,

>Is it possible to change AppDesktop() to a secondary monitor if a user
>moves the main application to that monitor? How?

The "AppDesktop" is an XbpIWindow object, an invisible window with the size 
of the virtual (initial) (main) desktop -- scaled according to the Windows 
OS settings. You can change the size and position of this XbpIWindow object, 
but you can't give it negative position coordinates. So, if your secondary 
monitor is to the left or above your main monitor, you are out of luck.

The real question is, why do you want to do this in the first place? You 
probably can achieve what you want to do without doing anything to that 
virtual Xbase++ AppDesktop object.

See also the "GraBitblt()" thread in the GUI newsgroup from March 26, 2020, 
for some more details on this.

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Itai Ben-ArtziRe: AppDeskTop() and multiple monitors.
on Sun, 12 Jul 2020 16:22:06 -0700
Thank you, Andrea
I use AppDesktop() as a parent and SetAppWindow() as owner of each
dialog-window (deployed by a terminal-server on each work-station). If
a user moves the main window [SetAppWindow()] to a secondary monitor,
each dialog-window still gets open at the main monitor, not where the
main window is placed.
My goal: if a user moves the main window to a secondary monitor, I'd
like to set that monitor as the parent [AppDesktop()] of the entire
application.
Andreas Gehrs-Pahl
Re: AppDeskTop() and multiple monitors.
on Mon, 13 Jul 2020 15:21:31 -0400
Itai,

>I use AppDesktop() as a parent and SetAppWindow() as owner of each
>dialog-window (deployed by a terminal-server on each work-station). If
>a user moves the main window [SetAppWindow()] to a secondary monitor,
>each dialog-window still gets open at the main monitor, not where the
>main window is placed.

>My goal: if a user moves the main window to a secondary monitor, I'd
>like to set that monitor as the parent [AppDesktop()] of the entire
>application.

AppDesktop():CurrentPos() will always return {0, 0}, defined as the Bottom 
Left corner of the Primary monitor, and AppDesktop():CurrentSize() will 
always return the size of the virtual desktop, spanning only the Primary 
monitor, adjusted for scaling. There is only one AppDesktop() object for all 
monitors -- not multiple ones for each monitor, though. The {0,0} coordinate 
of the AppDesktop() position isn't necessarily the bottom left of the lowest 
monitor on the left side. That position could contain negative values!

To position a dialog to the left or below the Bottom Left corner of the 
Primary monitor, you can use negative coordinates. To place a dialog 1000 
pixels to the left and 200 pixels lower than that Primary monitor's bottom 
left corner, you would use a position of: {-1000, -200}. Conversely, to 
place a dialog on the monitor to the top or right of the Primary monitor, 
use coordinates larger than the reported desktop size.

To determine the position of a monitor's desktop area, especially one that 
is located below and/or left of the Primary monitor, you can create a dialog 
on that monitor and maximize it. The position of that dialog will give you 
the bottom-left corner of that dialog and the dialog's size will give you 
the largest (maximized) size for dialogs on that monitor. You can do that 
programmatically, and store that info. With those coordinates at hand, you 
can compute an offset for all further dialogs, so that they appear on that 
monitor.

You can also use some of the functions that I provided in the earlier 
mentioned GUI newsgroup thread to determine the relative position and size 
of the desktop and monitors, and then create dialogs relative to those 
coordinates.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Andreas Gehrs-Pahl
Re: AppDeskTop() and multiple monitors.
on Mon, 13 Jul 2020 15:50:43 -0400
I wrote:

>AppDesktop():CurrentPos() will always return {0, 0}, defined as the Bottom 
>Left corner of the Primary monitor, and AppDesktop():CurrentSize() will 
>always return the size of the virtual desktop, spanning only the Primary 
>monitor, adjusted for scaling. There is only one AppDesktop() object for all 
>monitors -- not multiple ones for each monitor, though.

I would like to add that the AppDesktop() size is always the size of the 
scaled (virtualized) desktop of the primary monitor as it was at the time 
the program started. 

Changing the resolution, the scaling (DPI), or the monitor's position 
(relative to other ones), or making another monitor the primary one, will 
have absolutely no effect on the AppDesktop() size or position while the 
program is running! For that reason, relying on the AppDesktop() size or 
position for actual runtime decisions like sizing, scaling, positioning, 
etc., isn't recommended.

To determine those up-to-date values during runtime, you should use the 
functions supplied in my earlier (GUI newsgroup) post.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Itai Ben-ArtziRe: AppDeskTop() and multiple monitors.
on Wed, 15 Jul 2020 15:38:44 -0700
Thank you, thank you, thank you, Andreas!!
This helped a lot.
-Itai
Jim LeeRe: AppDeskTop() and multiple monitors.
on Sun, 12 Jul 2020 19:04:22 +0200
hi,

> Is it possible to change AppDesktop() to a secondary monitor if a user
> moves the main application to that monitor?  How?

when have 2 Monitor AppDesktop() give you Sum of both.

2nd Monitor can be right or left side ( you can change it in Windows )
to emun Monitor have a look at this Code from Pablo using Ot4xb




MonitorInfo.zip
Andreas Gehrs-Pahl
Re: AppDeskTop() and multiple monitors.
on Mon, 13 Jul 2020 15:34:37 -0400
Jim,

>when have 2 Monitor AppDesktop() give you Sum of both.

That's incorrect. AppDesktop() is an XbpIWindow with the size of the scaled, 
virtual, desktop of the Primary monitor. It doesn't even "cover" the entire 
Primary monitor's desktop, if scaling is used, not to mention additional 
monitors.

>2nd Monitor can be right or left side ( you can change it in Windows )
>to emun Monitor have a look at this Code from Pablo using Ot4xb

You don't even need OT4Xb to do any of this, just plain Xbase++. See also my 
aforementioned post in the "GraBitblt()" thread in the GUI newsgroup from 
March 26, 2020, for some more details on this.

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC