1
0
mirror of synced 2024-11-05 03:09:15 +00:00

Fixed: last item is skipped when using SelectLast

This commit is contained in:
Mark van Renswoude 2010-03-30 13:36:13 +00:00
parent da24dfd4d0
commit 6322d27e0c

View File

@ -2571,7 +2571,12 @@ var
begin
Result := nil;
groupIndex := 0;
case ADirection of
mbdUp: groupIndex := Pred(Groups.Count);
mbdDown: groupIndex := 0;
end;
itemIndex := -2;
abort := False;
@ -2656,26 +2661,12 @@ end;
function TX2CustomMenuBar.SelectLast: TX2CustomMenuBarItem;
var
startGroup: TX2MenuBarGroup;
startItem: TX2CustomMenuBarItem;
begin
Result := nil;
if Groups.Count = 0 then
Exit;
if AllowInteraction then
begin
{ Start from the last item in the last group }
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);
Result := Iterate(FindEnabledItem, mbdUp);
if Assigned(Result) then
SelectedItem := Result;
end;