[lazarus] Bug in lcl resizing code and patch for win32

Karl Brandt pascalive at bol.com.br
Sat Jun 28 16:28:02 EDT 2003


Micha Nelissen wrote:

>Karl Brandt wrote:
>  
>
>>Micha Nelissen wrote:
>>
>>    
>>
>>>Karl Brandt wrote:
>>>
>>>
>>>      
>>>
>>>>Sometime ago i sent a patch fixing the forms sizes under win32 and
>>>>got surprised to see that things were messed.
>>>>So i  did the  job again!
>>>>
>>>>Attached is a patch that makes the form sizes correct.
>>>>
>>>>
>>>>        
>>>>
>>>What was wrong? Those messages should send the same information as
>>>you retrieve via GetClientRect/GetWindowRect.
>>>
>>>
>>>      
>>>
>>In LCL, WindowSize = ClientSize while windows and VCL expect/returns
>>diferent sizes, so is needed  some adjustments.
>>    
>>
>
>That does not explain the WM_MOVE change. The WM_SIZE is defined as such:
>
>nWidth = LOWORD(lParam);  // width of client area
>nHeight = HIWORD(lParam); // height of client area
>
>Testing shows that those changes provide the same functionality, only
>slower.
>  
>
The LParam returns the client Top/Left coordinates that are diferent of 
window coordinates.
Try to debug this.
LCL expects the window coordinates.
For example: when a control is created with top,left =(0,0) the 
MoveWindow proc (ResizeChild)  fires WM_SIZE, WM_MOVE messages that are 
passed in windowproc.
If you send the client coordinates, that will be a greater than (0,0) 
let's say (4,24) the LCL will think that you moved the control (the 
top,left coordinates in LCL are 0,0) and will ask the Interface to move 
the control, creating that effect we see when we move the form.
The same occurs with WM_SIZE, but this time you must pass the Client 
coordinates.
See yourself: try to pass the WM_SIZE parameters directly to LCL,
make breakpoints in LM_SETSIZE , Tcontrol.WMSize and WM_SIZE process and 
inspect the size values

karl






More information about the Lazarus mailing list