[lazarus] Recreating ListBox/ComboBox handle in win32

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Aug 26 04:09:15 EDT 2003

On Tue, 26 Aug 2003 01:35:11 -0300
Karl Brandt <pascalive at bol.com.br> wrote:

> There's a problem (AKA bug) in RecreateListControl: the windowproc 
> address is not being set, which breaks link between listboxes and 
> comboboxes and LCL.
> I tried to rework the procedure setting the properties at same order of 
> LM_CREATE, but i got unusable controls.
> The patch comments RecreateListControl calls and rewrite the procedure 
> to accomplish the above, although without sucess.
> It also cleans SetComboHeight(Sending WM_SIZE message is no more 
> necessary) and fix a typo at win32List.Add
> Note that MultiSelect, Sorted implementation rellies at recreating the 
> handle.

The patch failed on SetComboHeight and the compilation failed on
I have applied the patch and fixed the compilation manually. Please check

> I see four ways to go:
> 1) Find a way to change MultiSelect, Sorted properties under win32 on 
> the fly, without recreating handle. The ideal, although improbable.
> 2) The properties could be set in LM_CREATE handling, so 
> TWincontrol.RecreateWnd could be called. Now the cited properties are 
> set after LM_CREATE, with LM_SETSORTED and LM_SETSELMODE which causes a 
> endless loop calling RecreateWindow.

Endless loop?
Is the win32 intf checking, if MultiSelect and Sort are already set? A
RecreateWnd should not result in an endless loop. It is an allowed
operation. Especially as the VCL uses it a lot.

> This has a good side effect: now the handle are created three times for 
> each ListBox(LM_CREATE,LM_SETSORTED,LM_SETSELMODE) and twice for each
> combo. The problem is that should be defined at LCL that these features
> should be checked/set at create handling.
> This is the most viable
> 3) Doesn't allow to change these properties at runtime under win32 ????
> 4) Fix the problem in RecreateListControl. Volunteers, please.

Why not fix LM_CREATE in the win32 intf to create a Handle with the correct
flags and add some code to LM_SETxxx to check if RecreateWnd is needed?

> PS: not recreating the handles, makes the listboxes to be drawn (but 
> works fine)incorrectly (Looks the same problem as TMemo), but it's not a 
> new bug. It's a previous hidden bug. In the other side, allows the user 
> to use the combobox at ObjectInspector :-)

a phyrus victory


More information about the Lazarus mailing list