[lazarus] Patch for win32 : GetRelativePosition

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Jul 20 02:25:26 EDT 2003


On Sun, 20 Jul 2003 01:53:37 -0300
Karl Brandt <pascalive at bol.com.br> wrote:

> I'm sending a patch with a implementation for win32 interface of the
> cited procedure. This time, i think it's a correct one.

Applied.


> It also  refine WM_MOVE : now, not Forms controls send the correct
> position
> There's two way of testing if is Form/Not child in the patch. I'll let 
> to Mattias  to decide wich one to pick. I think the result is the same.
> 
> BTW: How time/resource consuming are Is and As operators?. I'm afraid
> that using these in interfaces can degradate the performance
> 
> there's two problems in the generic (interfacebase) version of this
> procedure:
> First, the ParentLeftTop var is not initialized, returning random values.

Fixed


> Second, the ClientToScreen procedure returns the screen position of a
> coordinate relative to the client area of the supplied window, 

Hmm. Sounds exactly like what we need.
My idea was the following:
"GetWindowRelativePosition" should return the same as the "Left", "Top"
properties of a TWinControl. The Left, Top are defined as relative to the
client origin of its parent. For example: A wincontrol at screen coordinates
200,100 with a 10 pixel broad frame, has a client origin in screen
coordinates at 210,110. A child wincontrol with Left=30, Top=20 will be at
the screen coordinates 240,130.
GetWindowRect for the ChildHandle will return 240,130.
ClientToScreen(0,0) for the ParentHandle will return 210,110.
The difference is the Left, Top: 30,20.


> which is not useful in this case.
> These was causing the child controls to not display, and making the
> ide/big applications to consume the memory in minutes (why??)

Maybe it was due to uninitialized ParentLeftTop?

> It can be implemented in a similar way i did.


Mattias






More information about the Lazarus mailing list