问题
How do you read and write RibbonApplicationMenuBar
recent items to a file or an INI file?
The help file is not very helpful for getting at the list of recent item strings to save and reload the recent items. I can add items to the recent items list by Ribbon1.AddRecentItem( APathFilename)
and open the file associated with the recent item with the RecentItemClick
event but I can not figure out how to save and reload recent filenames to the recent items list.
回答1:
The TRibbonApplicationMenuBar has a RecentItems property, which provides access to a list of each recent item.
// example code - untested.
RibbonApplicationMenuBar1.RecentItems.Items[1].Caption;
Another example for looping though each item.
// example code - untested.
var
count : Integer;
begin
For count := 1 to RibbonApplicationMenuBar1.RecentItems.Items.Count do
begin
ShowMessage(RibbonApplicationMenuBar1.RecentItems.Items[count].Caption);
end;
end;
来源:https://stackoverflow.com/questions/1402373/how-to-read-and-write-delphi-2010-ribbonapplicationmenubar-recent-items-to-a-fil