mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 14:56:00 +02:00
LCL: set Windows listbox itemindex to -1 if nothing is selected. Issue #19893
git-svn-id: trunk@31884 -
This commit is contained in:
parent
7e2778735b
commit
69a63a5af6
@ -65,6 +65,8 @@ begin
|
||||
FFlagSetItemData := UINT(LB_SETITEMDATA);
|
||||
FFlagGetItemIndex := UINT(LB_GETCURSEL);
|
||||
FFlagSetItemIndex := UINT(LB_SETCURSEL);
|
||||
FFlagGetCaretIndex := UINT(LB_GETCARETINDEX);
|
||||
FFlagSetCaretIndex := UINT(LB_SETCARETINDEX);
|
||||
FFlagGetSelected := UINT(LB_GETSEL);
|
||||
FFlagSetSelected := UINT(LB_SETSEL);
|
||||
FFlagInitStorage := UINT(LB_INITSTORAGE);
|
||||
@ -244,7 +246,12 @@ end;
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWin32ListStringList.Insert(Index: Integer; Const S: String);
|
||||
var
|
||||
lItemIndex: Integer;
|
||||
begin
|
||||
if (FFlagGetCaretIndex <> 0) and (GetCount = 0) then
|
||||
lItemIndex := SendMessage(FWin32List, FFlagGetCaretIndex, 0, 0);
|
||||
|
||||
FLastInsertedIndex := Index;
|
||||
if FSorted then
|
||||
begin
|
||||
@ -268,6 +275,9 @@ begin
|
||||
Windows.SendMessage(FWin32List, FFlagInsertString, Index, LPARAM(PChar(S)));
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
if (FFlagSetCaretIndex <> 0) and (GetCount = 1) then
|
||||
SendMessage(FWin32List, FFlagSetCaretIndex, lItemIndex, 0);
|
||||
end;
|
||||
|
||||
procedure TWin32ListStringList.Put(Index: integer; const S: string);
|
||||
@ -345,6 +355,8 @@ begin
|
||||
FFlagSetItemData := UINT(CB_SETITEMDATA);
|
||||
FFlagGetItemIndex := UINT(CB_GETCURSEL);
|
||||
FFlagSetItemIndex := UINT(CB_SETCURSEL);
|
||||
FFlagGetCaretIndex := UINT(0);
|
||||
FFlagSetCaretIndex := UINT(0);
|
||||
FFlagGetSelected := UINT(0);
|
||||
FFlagSetSelected := UINT(0);
|
||||
FFlagInitStorage := UINT(CB_INITSTORAGE);
|
||||
|
@ -50,6 +50,8 @@ Type
|
||||
FFlagSetItemData: Cardinal;
|
||||
FFlagGetItemIndex: cardinal;
|
||||
FFlagSetItemIndex: cardinal;
|
||||
FFlagGetCaretIndex: cardinal;
|
||||
FFlagSetCaretIndex: cardinal;
|
||||
FFlagGetSelected: cardinal;
|
||||
FFlagsetSelected: cardinal;
|
||||
FFlagInitStorage: cardinal;
|
||||
|
@ -769,8 +769,8 @@ begin
|
||||
if AIndex >= 0 then
|
||||
begin
|
||||
Windows.SendMessage(Handle, LB_SETSEL, Windows.WParam(true), Windows.LParam(AIndex));
|
||||
Windows.SendMessage(Handle, LB_SETCARETINDEX, Windows.WParam(AIndex), 0);
|
||||
end;
|
||||
Windows.SendMessage(Handle, LB_SETCARETINDEX, Windows.WParam(AIndex), 0);
|
||||
end else
|
||||
Windows.SendMessage(Handle, LB_SETCURSEL, Windows.WParam(AIndex), 0);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user