mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 11:39:13 +02:00
TCheckListBox: when user presses spacebar:
- if ItemIndex = -1: set it to 0 and fire OnClick; - fire OnClickCheck. Issue #0024695. git-svn-id: trunk@47992 -
This commit is contained in:
parent
82b49e8841
commit
62711a2bb8
@ -299,12 +299,23 @@ procedure TCustomCheckListBox.KeyDown(var Key: Word; Shift: TShiftState);
|
|||||||
var
|
var
|
||||||
Index: Integer;
|
Index: Integer;
|
||||||
begin
|
begin
|
||||||
if (Key = VK_SPACE) and (Shift=[]) and (ItemIndex >= 0) and ItemEnabled[ItemIndex] then
|
if (Key = VK_SPACE) and (Shift=[]) then
|
||||||
begin
|
begin
|
||||||
Index := ItemIndex;
|
//Delphi (7) sets ItemIndex to 0 in this case and fires OnClick
|
||||||
Checked[Index] := not Checked[Index];
|
if (ItemIndex < 0) and (Items.Count >= 0) then
|
||||||
ItemClick(Index);
|
begin
|
||||||
Key := VK_UNKNOWN;
|
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
|
end else
|
||||||
inherited KeyDown(Key,Shift);
|
inherited KeyDown(Key,Shift);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user