Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2023-09

Window Position

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Timothy Groves

Whenever a program I have written opens a created form, that form always appears precisely where it sat at design time, even if that would be way off the screen (my workstation has a 3440x1440 display, but the laptop I run many programs on has only 1280x800).? Typically, I have to encode something in FormCreate to force it to move, which is no better really.? Why won't the window manager just place it where it feels it should be, as it does with every other program out there?? I've tried changing form.Position in the Object Inspector to poDefault, or poDefaultSizeOnly and that made no difference, and if I set it to poDefaultPosOnly, it turns off AutoSize, and *still* makes no difference.? Is there any way to disable this behaviour?

Reply by email

Michael Van Canneyt
to Timothy Groves
Timothy Groves wrote 11 lines
Whenever a program I have written opens a created form, that form always appears precisely where it sat at design time, even if that would be way off the screen (my workstation has a 3440x1440 display, but the laptop I run many programs on has only 1280x800).? Typically, I have to encode something in FormCreate to force it to move, which is no better really.? Why won't the window manager just place it where it feels it should be, as it does with every other program out there?? I've tried changing form.Position in the Object Inspector to poDefault, or poDefaultSizeOnly and that made no difference, and if I set it to poDefaultPosOnly, it turns off AutoSize, and *still* makes no difference.? Is there any way to disable this behaviour?

What's wrong with using poScreenCenter or poDesktopCenter ?

Michael.

Reply by email

Timothy Groves
to Michael Van Canneyt

For many of the programs I write, those work.? For some, however - mostly the small assistant programs - I still have to manually relocate them, rather than allowing the window manager to place them.? Either way, I'd still rather have the option to simply allow the window manager to handle it, rather than trying to force a location.

Michael Van Canneyt wrote
What's wrong with using poScreenCenter or poDesktopCenter ?

Reply by email

Mattias Gaertner
to Timothy Groves: Whenever a program I have written opens a created form, that form always appears…
Timothy Groves wrote 11 lines
Whenever a program I have written opens a created form, that form always appears precisely where it sat at design time, even if that would be way off the screen (my workstation has a 3440x1440 display, but the laptop I run many programs on has only 1280x800).? Typically, I have to encode something in FormCreate to force it to move, which is no better really. Why won't the window manager just place it where it feels it should be, as it does with every other program out there?? I've tried changing form.Position in the Object Inspector to poDefault, or poDefaultSizeOnly and that made no difference, and if I set it to poDefaultPosOnly, it turns off AutoSize, and *still* makes no difference.? Is there any way to disable this behaviour?

The gtk has such default position. It should be possible to support poDefault there.

Mattias

Reply by email

Kostas Michalopoulos
to Mattias Gaertner
Mattias Gaertner wrote
The gtk has such default position. It should be possible to support poDefault there.

From a quick look in the Gtk2 widgetset code, the position could be set (or actually, not set for poDefault and poDefaultPosOnly) via SetWindowSizeAndPosition *however* because this is called both during form creation and to make the form visible, somehow it needs to only be done the first time (after creation) since after that the program should be able to change the position programmatically and a call to Hide followed by a call to Show should place the window at the last position set programmatically instead of ignoring the bounds properties (which is what it should do for the first time based on the Position property's value).

I didn't make a thorough search but i couldn't find where the size is set as even commenting out all the code in SetWindowSizeAndPosition as well as setting some random values for the allocation during creation the form still seems to be set at the design-time size. LCL seems to try very hard to ensure the size and position are set :-P.

(actually in general it seems to try hard to override what the window manager does - sometimes i have an issue with Window Maker where Lazarus somehow brings all of its windows above other windows when alt-tabbing away to another program... i haven't figured out why that happens though as it hasn't crossed yet my "too much annoyance" threshold to investigate :-P)

Kostas

Reply by email