[lazarus] ComboBox problems

Karl Brandt pascalive at bol.com.br
Wed Aug 13 11:19:17 EDT 2003


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 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. It's a better solution then the current.

karl






-------------- next part --------------
A non-text attachment was scrubbed...
Name: zip00028.zip
Type: application/octet-stream
Size: 2955 bytes
Desc: "comboagain.zip"
Url : http://localhost/pipermail/lazarus/attachments/20030813/632f9470/zip00028.obj


More information about the Lazarus mailing list