- Код: Выделить всё
//Удаляем старую историю из ActionList
for i:=1 to 10 do begin
tpInt:=ActMain.IndexOfName(Format('ActFileHistory%.2d',[i]));
if tpInt>-1 then ActMain.Actions[tpInt].Free;
end;
//Создаем новые действия для истории
if Options.OpenHistory.Count>0 then for i:=1 to Options.OpenHistory.Count do begin
HistoryAction:=TAction.Create(ActMain);
HistoryAction.Name:=Format('ActFileHistory%.2d',[i]);
(HistoryAction as TAction).Caption:=Options.OpenHistory[i-1];
(HistoryAction as TAction).Tag:=i-1;
(HistoryAction as TAction).OnExecute:=@OpenFromHistory;
(HistoryAction as TAction).Update;
end;
В итоге на строке
- Код: Выделить всё
HistoryAction.Name:=Format('ActFileHistory%.2d',[i]);
получаю ошибку дублирующихся имен. Как это?