[lazarus] Bugs in TCustomListBox
pascalive at bol.com.br
Sun Dec 29 10:31:16 EST 2002
Mattias Gaertner wrote:
>On Sat, 28 Dec 2002 18:59:03 -0200
>Karl Brandt <pascalive at bol.com.br> wrote:
>> 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
>> Msg:= LM_SORT;
>> --> List:= TObject(Pointer(CNSendMessage(LM_GETITEMS, Self, nil)));
>> IsSorted:= FSorted;
>> 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.
>I changed that (but didn't test a win32 compilation).
I updated and it's OK(with the ListBox code and the crash).
But, how about property Sorted being public in TCustomListBox?
This will make easier/faster to get this property working under win32.
Is there any problem with this?
More information about the Lazarus