[Lazarus] Window Position

Kostas Michalopoulos badsector at runtimeterror.com
Sat Sep 23 02:43:16 CEST 2023

On 9/22/23 15:26, Mattias Gaertner via lazarus 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 

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)


More information about the lazarus mailing list