[lazarus] ComboBox problems

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Aug 13 12:03:14 EDT 2003

On Wed, 13 Aug 2003 12:50:23 -0300
Karl Brandt <pascalive at bol.com.br> wrote:

> In the last week i looked at the problems with ComboBox
> height/positioning and noticed the following:
> --Behavior of setting combo(CS_DROPDOWN) height:
>     When you set the height of the combo to an alleatory value (let's
> say 100), the DefaultWndProc (called with DefWindowProc or
> CallWindowProc) resizes the combo to a value based in the font of the
> control(in the case of DEFAULT_GUI_FONT, 21) and then sends a new
> WM_SIZE to control with the corrected size, which is the value we get
> calling GetClientRect and GetWindowRect
> --PropertyGrid being pushed for down when combobox was droppedown:
>    TWin32Object.SetComboMinDropDownSize increments the height of
> combobox progressively each time is called. Just put some writeln in 
> TWincontrol.WMSIZE to inspect what happen with the LCL height.
> But according to what i said before the LCL should  receive only the 
> correct value. But it doesn't. This is what happens
>    Height is set to 100
>    WM_SIZE message with parameter = 100
>    Default window proc is called
>       Height is modified to 21
>       a new WM_SIZE message is sent with parameter = 21
>       LCL is updated with Height = 21
>    Default window proc finishes and returns to WindowProc
>    LCL is updated with Height = 100
>    Now we have diferents sizes between LCL and win32
> with TWin32Object.SetComboMinDropDownSize  the height goes to more then 
> 1000 easily. This is not noted because win32 ignores it and adjust the 
> dropdown according to the number of items
> I see the following solutions
> 1) Call DefWindowproc after sending the message to LCL
>     But this can affect other messages/controls
> 2) Implements a TCustomComboBox.WMSize proc that retrieves the 
> current/real size from interface and call inherited with updated value
> 3) sends a WM_SIZE message with correct value -> did in the patch

The 3) is right. Whenever the LCL or the interface changes the height, a
WM_SIZE message should be sent to tell the other.

> The patch fix the current (more to come) issues: diferences between 
> Height in LCL/win32, Notebook control in ObjectInspector is aligned 
> exactly where should do, strange effects in Enviroment options dialog,
> can't see more than 9 items.
> I hope this can be applied. 

The internet is bomb safe, but not virus safe. 
Finally applied. It seems "cvs commit" is ten times slower than all other
cvs operations.

> It's a better solution then the current.

Adding lines to TWin32ListStringList.Insert, removing them, adding them. I
hope you and Micha will finally find a solution for a six lines method. :)


More information about the Lazarus mailing list