Fixed: last item is skipped when using SelectLast
This commit is contained in:
parent
da24dfd4d0
commit
6322d27e0c
@ -2571,7 +2571,12 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
groupIndex := 0;
|
|
||||||
|
case ADirection of
|
||||||
|
mbdUp: groupIndex := Pred(Groups.Count);
|
||||||
|
mbdDown: groupIndex := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
itemIndex := -2;
|
itemIndex := -2;
|
||||||
abort := False;
|
abort := False;
|
||||||
|
|
||||||
@ -2656,26 +2661,12 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
function TX2CustomMenuBar.SelectLast: TX2CustomMenuBarItem;
|
function TX2CustomMenuBar.SelectLast: TX2CustomMenuBarItem;
|
||||||
var
|
|
||||||
startGroup: TX2MenuBarGroup;
|
|
||||||
startItem: TX2CustomMenuBarItem;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if Groups.Count = 0 then
|
|
||||||
Exit;
|
|
||||||
|
|
||||||
if AllowInteraction then
|
if AllowInteraction then
|
||||||
begin
|
begin
|
||||||
{ Start from the last item in the last group }
|
Result := Iterate(FindEnabledItem, mbdUp);
|
||||||
startGroup := Groups[Pred(Groups.Count)];
|
|
||||||
|
|
||||||
if startGroup.Items.Count > 0 then
|
|
||||||
startItem := startGroup.Items[Pred(startGroup.Items.Count)]
|
|
||||||
else
|
|
||||||
startItem := startGroup;
|
|
||||||
|
|
||||||
Result := Iterate(FindEnabledItem, mbdUp, nil, startItem);
|
|
||||||
if Assigned(Result) then
|
if Assigned(Result) then
|
||||||
SelectedItem := Result;
|
SelectedItem := Result;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user