[Gambas-user] Screen.class could do with "TotalWidth" or something
Bruce Steers
bsteers4 at gmail.com
Sun Nov 6 15:04:15 CET 2022
I added this function to Screens.class in my project that i think correctly
gets total size...
*Static Private Function Area_Read() As Rect $hRect = New
Rect(Screens[0].X, Screens[0].Y, Screens[0].W, Screens[0].H) If
Screens.Count > 1 Then Dim hNewRect As Rect For c As Integer = 1 To
Screens.Count - 1 hNewRect = New Rect(Screens[c].X, Screens[c].Y,
Screens[c].W, Screens[c].H) $hRect = $hRect.Union(hNewRect) Next
Endif Return $hRectEnd*
So i can inspect Screens.Area for the Rect of total size.
I also added *Screens.Width* and *Screens.Height* that are *.W* & *.H* of
the *Rect* like this...
*Return Area_Read().Width*
Also *Screens.Max*
currently working on a *Screens.Active* as a more functional way to get the
active screen at application startup.
On Mon, 31 Oct 2022 at 14:29, Bruce Steers <bsteers4 at gmail.com> wrote:
> I've just been investigating Screen.class with 2 monitors connected.
>
> It seems if my primary monitor is to the left of the secondary I get this
> info from Screen.class
>
> Screen.X = 0
> Screen.Width = Primary width
> (no information about secondary display)
>
> If the primary is to the right then i get this..
> Screen.X = secondary screen width
> Screen.Width = primary screen width
>
> so seeing Screen.X is the width of the other monitor i can see i have 2
> monitors and i can move the window over to the other screen.
> (i did not try but i assume Form.Move() will use a negative number)
>
> even if i have to use X11.MoveWindow at least i can use the fact Screen.X
> is not zero to detect a secondary monitor to the left.
>
> It would be great to get better info about another monitor if the primary
> is on the left though.
>
> Maybe something like a Screen.TotalWidth or Screen.ExtendedWidth could be
> something that refers to a larger overall usable display size not just the
> monitor width? then we can detect a secondary on the right as well.
>
> Respects
> BruceS
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221106/cc870e00/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screens.class.zip
Type: application/zip
Size: 685 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221106/cc870e00/attachment.zip>
More information about the User
mailing list