I'm using the following method to create a an ActionClient with an Action at run time.
procedure TMainForm.AddToProjectHistory(Path: string);
var
NewOption: TAction;
ActionClient: TActionClientItem;
begin
NewOption := TAction.Create(self);
NewOption.ActionList := ActionManager1;
NewOption.Caption := Path;
NewOption.OnExecute := ProjectHistoryExecute;
ActionClient := TActionClientItem(aToolBarFile.ActionClient.Items[0].Items.Add);
ActionClient.Action := NewOption;
ActionClient.Caption := Path;
end;
This works fine if there is already an item in the list, but doesn't work at all if there isn't
e.g. if I add an Item at design time then I can add more items at runtime
But if I don't add anything at design time, theres no Drop Down to display the list of items, no drop down appears after adding items.
This doesn't have to be done with Actions but the rest of the menu system uses actions and I don't think I can add standard MenuItems to the action drop down.
Delphi 2005
ActionClient.Caption
is superfluous when it is set to the same value of that of the action. – NGLN