Sign in Join

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

Mailing lists / lazarus / 2003-07

GetWindowRelativePosition implementation patch for win32

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Karl Brandt

I noticed that Mattias added a new WinApi function which doesn't exist in win32.
Attached is a implementation.
The patch also removes a not necessary call to GetClientRect in WM_SIZE.

This fixes the problem i previous noticed after the WMMove/WMSize modifications.

karl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: zip00012.zip
Type: application/octet-stream
Size: 905 bytes
Desc: "getrel.zip"
Url : http://localhost/pipermail/lazarus/attachments/20030706/1a63d7ec/zip00012.obj

Reply by email

Mattias Gaertner
to Karl Brandt
I noticed that Mattias added a new WinApi function which doesn't exist in win32.
It was:
function GetWindowRelativePosition(Handle : hwnd; var Left, Top: integer):
boolean;

It returns the Left, Top, relative to the client origin of its parent. This is the same as TControl.Left, TControl.Top. But during resizing these values do not always correspond. The LCL uses this function to sync itself with the interface.
I also added a default implementation in interfacebase, based on other functions, already implemented. So, the interfaces don't need to implement it. The gtk-interface overrides it and provides a faster implementation.

Attached is a implementation.

Hmm. You used GetWindowRect, which returns the left,top in screen coordinates. I don't think, that this is correct, so I replaced its implementation with a call to inherited.

The patch also removes a not necessary call to GetClientRect in WM_SIZE. This fixes the problem i previous noticed after the WMMove/WMSize modifications.

I will make some tests with resizing ...

Mattias

Reply by email