[lazarus] Patch for win32 : GetRelativePosition

Karl Brandt pascalive at bol.com.br
Sun Jul 20 10:12:42 EDT 2003


Mattias Gaertner wrote:
> 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.
> 
> 
Thanks
> 
>>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

Thanks
What do you think about using Is and As?
> 
>>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.
> 

Sorry.
I was thinking that you wanted to pass (Parent.Left,Parent.Top) ;-)

> 
>>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?
> 
  I will take a look.
  Fixing only the interface proc the main ide runs without (many) 
problems, but opening the Envir Options forms, the form is not painted 
and the memory usage grows quickly.

Do you know where i can find teorical documents about memory issues 
(leaks) and pascal?


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






More information about the Lazarus mailing list