[Lazarus] GetWindowSize misleading documentation or bug?

zeljko zeljko at holobit.net
Sat Sep 27 14:32:05 CEST 2014


On 09/27/2014 12:26 PM, Luca Olivetti wrote:
> El 27/09/14 12:23, Luca Olivetti ha escrit:
>> El 27/09/14 12:09, Luca Olivetti ha escrit:
>>>
>>> I'm puzzled: with a test program I see no difference in the size in both
>>> cases (right after showing the form and after pressing the button) *and*
>>> the size is the right one (in FormShow is always 1,1 btw).
>>> I must be doing something else wrong (though the tiling is the correct
>>> on under windows, mmmh..).
>>
>> Found it, nothing wrong on my part: the test program used an auto
>> created form, the real application creates the form at run time *and*
>> right after creating the form, after the show GetWindowRect only returns
>> the client size. I have to introduce a delay for it to return the whole
>> window's size (and even then, from time to time, it only returns the
>> client size), so you were correct and this is insane.
>
> And, for the record, with qt it's the same (only it seems the delay have
> to be bigger).

Under X11 nobody knows exact window size (except client size setted up 
by LCL or widgetset) until window is decorated by wm (read mapped - 
shown on screen). See
http://qt-project.org/doc/qt-4.8/application-windows.html#x11-peculiarities
It's almost same for gtk2 and other X11 widgetsets.
Problem is that you cannot query wm for eg. title bar height,form 
borders separately so then it will be easy to calculate everything.
Hope that wayland will address this problems.

zeljko





More information about the Lazarus mailing list