mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-06 12:00:40 +02:00
LCL: Prevent crash in RadioGroup when hidden radiobutton is selected by arrow keys. Issue #41093.
(cherry picked from commit 48cf66858d
)
This commit is contained in:
parent
3ae3be09ad
commit
830ac027c9
@ -264,6 +264,7 @@ procedure TCustomRadioGroup.ItemKeyDown(Sender: TObject; var Key: Word;
|
||||
BlockSize : integer;
|
||||
NewIndex : integer;
|
||||
WrapOffset: integer;
|
||||
Butt: TRadioButton;
|
||||
begin
|
||||
Count := FButtonList.Count;
|
||||
if FColumnLayout=clHorizontalThenVertical then begin
|
||||
@ -287,9 +288,11 @@ procedure TCustomRadioGroup.ItemKeyDown(Sender: TObject; var Key: Word;
|
||||
while NewIndex >= Count do
|
||||
NewIndex := (NewIndex + StepSize) mod BlockSize;
|
||||
end;
|
||||
until (NewIndex = ItemIndex) or TRadioButton(FButtonList[NewIndex]).Enabled;
|
||||
Butt := TRadioButton(FButtonList[NewIndex]);
|
||||
until (NewIndex = ItemIndex) or (Butt.Visible and Butt.Enabled);
|
||||
ItemIndex := NewIndex;
|
||||
TRadioButton(FButtonList[ItemIndex]).SetFocus;
|
||||
if Butt.CanSetFocus then // ItemIndex = NewIndex, Butt is still valid.
|
||||
Butt.SetFocus;
|
||||
Key := 0;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user