[Gambas-user] an observation on window placement with multiple screens

Bruce Steers bsteers4 at gmail.com
Mon Nov 7 17:22:10 CET 2022

On Mon, 7 Nov 2022 at 00:14, Bruce Steers <bsteers4 at gmail.com> wrote:

> On Sun, 6 Nov 2022 at 22:50, Bruce Steers <bsteers4 at gmail.com> wrote:
>> i've edited it to have a couple of additional properies...
>> *Form.ModalMode*
>> select a mode
>>  MODAL_NORMAL, normal gambas mode
>>  MODAL_SAMESCREEN, move centered on the same screen as the active window
>>  MODAL_WINDOWSTACK, move to the calling windows TopLeft position
>>  MODAL_WINDOWCENTER, move centered to the active window
>> *Form.ModalMode_Windows* As String[]
>> to limit the windows it will operate on by checking the Forms name
>> Eg.
>> Form.ModalMode_Windows = ["FMessage", "FInputBox"]
>> Attached is a simple test app to see the different modes on the message
>> box.
>> Maybe this will help others , or even inspire our Ben to implement
>> something similar in the matrix :)
>> Respects

I made a few updates to this routine.
I added a *Form.ModalUseForm* property so if you set it to FMain then all
modal windows use the selected ModalMode on FMain and not the Active window
(i figured ActiveWindow could change and not be what you want)

It's kinda handy not just as a fix for opening on the same screen as your
app but also nice if you have another reason for messages and other modal
windows to stick to a particular window and not just be center screen.

Rather than keep posting it here you can get it at the gambasone forum


Benoit, would you consider something like this for us ?
Having modals and other windows open on the same screen as the application
is quite beneficial and to be frank, the fact it's not how it works by
default is a bit of a let down. (hence my initial moaning)
 I tried while on holiday to have a movie playing on the cabins telly
through the laptops hdmi while doing gambas on the laptop screen. it was
impossible as the display config had the telly above the laptop. i wish i
had know then that if i had it so the laptop was to the left of the telly
then my windows would have popped up on the correct screen. swapping
screens primary/secondary had no effect.

Having them cling to another window is also beneficial (and btw it fixed
the other Bruces issue and made him very happy)

But the way I'm doing it here is clearly a tacky workaround (an awesome
tacky workaround ;) ) as the window opens at it's original position for a
moment then moves to the desired one.
possibly you could open up a similar method as I have implemented here.

To be blunt using gambas on multiple screens can be rubbish. It is only
practical if the screens are a certain way round, otherwise every window
that does not use Settings.Write() opens on the wrong screen.
This can be said for any gambas application including the gambas IDE

It would be good if all forms/windows could have an option or by default
attempt to either stick to A) the active screen , B) a selected screen, C)
the active window, D) a selected window.

I understand that some desktops like wayland do not support it but it's be
great to have the option/feature if on a system that does.
Or could it be possible that I could use the above mentioned code I made
but could somehow modify the modal windows position "before" it opens?

Many Respects
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221107/350024bb/attachment.htm>

More information about the User mailing list