mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 20:20:47 +02:00
Merged revision(s) 47992-47993 #62711a2bb8-#62711a2bb8 from trunk:
TCheckListBox: when user presses spacebar: - if ItemIndex = -1: set it to 0 and fire OnClick; - fire OnClickCheck. Issue #0024695. ........ TCheckListBox: fix possible crash introduced in r47992 #62711a2bb8. ........ git-svn-id: branches/fixes_1_4@48006 -
This commit is contained in:
parent
56c999a639
commit
5046cb4dc1
@ -306,12 +306,23 @@ procedure TCustomCheckListBox.KeyDown(var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if (Key = VK_SPACE) and (Shift=[]) and (ItemIndex >= 0) and ItemEnabled[ItemIndex] then
|
||||
if (Key = VK_SPACE) and (Shift=[]) then
|
||||
begin
|
||||
Index := ItemIndex;
|
||||
Checked[Index] := not Checked[Index];
|
||||
ItemClick(Index);
|
||||
Key := VK_UNKNOWN;
|
||||
//Delphi (7) sets ItemIndex to 0 in this case and fires OnClick
|
||||
if (ItemIndex < 0) and (Items.Count > 0) then
|
||||
begin
|
||||
ItemIndex := 0;
|
||||
Click;
|
||||
end;
|
||||
if (ItemIndex >= 0) and ItemEnabled[ItemIndex] then
|
||||
begin
|
||||
Index := ItemIndex;
|
||||
Checked[Index] := not Checked[Index];
|
||||
ClickCheck;
|
||||
//ToDo: does Delphi fire OnItemClick and in the same order?
|
||||
ItemClick(Index);
|
||||
Key := VK_UNKNOWN;
|
||||
end;
|
||||
end else
|
||||
inherited KeyDown(Key,Shift);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user