[lazarus] Bugs in TCustomListBox
pascalive at bol.com.br
Sat Dec 28 15:42:35 EST 2002
While trying to implement the ListBox/ComboBox under win32 i found
some bugs In TCustomListBox code:
(1) Some time ago, Martin Smat found that the wrong Items object was
being sent through LM_SORT message (TCustomListBox.UpdateSorted).
The problem is that the FItems is created as TExtendedStringList and
the interface expects a interface list type. The current solution is
wrong because CNSendMessage(LM_GETITEMS, Self, nil) returns a new
instance of the interface list and not the current list (see LM_GETITEMS).
var AMessage : TLMSort;
if not HandleAllocated then exit;
with AMessage do begin
--> List:= TObject(Pointer(CNSendMessage(LM_GETITEMS, Self, nil)));
CNSendMessage(LM_SORT, Self, @AMessage);
In CreateHandle,if UpdateSorted is called after FItems is converted to
a interface list type then we could just send FItems to the interface;
To win32 is necessary that UpdateSelectionMode also come after the
(2) In LM_SETBORDER message (gtk and win32) there's a explicit typecast
that may be wrong:
If (TControl(Sender).fCompStyle = csListBox) Or
(TControl(Sender).FCompStyle = csCListBox) Then
If -> TListBox(Sender)<-.BorderStyle =
If the control is TCListBox the type cast is wrong. It's not causing
errors, but i thing that should be corrected.
I propose to make the BorderStyle property public in TCustomListBox
so we can typecast to TCustomListBox and not to TListBox.
BTW is there any problem to make the Sorted property public in
This would facilitate the implementation of Sorted under win32.
More information about the Lazarus