@@ -50,7 +50,7 @@ TRibbonMarkupElement = record
5050 TRibbonMarkupElementList = class (TList<TRibbonMarkupElement>)
5151 strict private
5252 fResourceName: string;
53- class var fContainer: TList <TRibbonMarkupElementList>;
53+ class var fContainer: TObjectList <TRibbonMarkupElementList>;
5454 class constructor Create;
5555 class destructor Destroy;
5656 public
@@ -224,6 +224,18 @@ TUIRibbon = class(TWinControl, IUIApplication)
224224 // / Localize the given Ribbon command using the resource identifiers of the given markup item.
225225 // / </summary>
226226 procedure LocalizeRibbonElement (const pCommand: TUICommand; const pMarkupItem: TRibbonMarkupElement);
227+
228+ // / <summary>
229+ // / Gets or sets the mapping dictionary, which is automatically created by
230+ // / the "Ribbon Designer" of the "Windows Ribbon Framework".
231+ // / </summary>
232+ // / <remarks>
233+ // / The mapping dictionary is contained in the pascal file, created by the
234+ // / the "Ribbon Designer" of the "Windows Ribbon Framework". It contains
235+ // / the required mapping between Ribbon command identifier and the
236+ // / corresponding Action of the assigned ActionManager.
237+ // / </remarks>
238+ property RibbonMapper: TRibbonMarkupElementList read fRibbonMapper write fRibbonMapper;
227239 { $ENDREGION 'Internal Declarations'}
228240 public
229241
@@ -406,18 +418,6 @@ TUIRibbon = class(TWinControl, IUIApplication)
406418 // / <seealso>TRibbonApplicationModes</seealso>
407419 property ApplicationModes: TRibbonApplicationModes read fApplicationModes write Set_ApplicationModes;
408420
409- // / <summary>
410- // / Gets or sets the mapping dictionary, which is automatically created by
411- // / the "Ribbon Designer" of the "Windows Ribbon Framework".
412- // / </summary>
413- // / <remarks>
414- // / The mapping dictionary is contained in the pascal file, created by the
415- // / the "Ribbon Designer" of the "Windows Ribbon Framework". It contains
416- // / the required mapping between Ribbon command identifier and the
417- // / corresponding Action of the assigned ActionManager.
418- // / </remarks>
419- property RibbonMapper: TRibbonMarkupElementList read fRibbonMapper write fRibbonMapper;
420-
421421 published
422422
423423 { The name of the Ribbon resource as it is stored in the resource file. }
@@ -498,7 +498,7 @@ constructor TRibbonMarkupElementList.Create(pResourceName: string);
498498 inherited Create();
499499 fResourceName := pResourceName;
500500 if not Assigned(fContainer) then
501- fContainer := TList <TRibbonMarkupElementList>.Create();
501+ fContainer := TObjectList <TRibbonMarkupElementList>.Create(True );
502502 fContainer.Add(Self);
503503end ;
504504
@@ -617,7 +617,6 @@ destructor TUIRibbon.Destroy;
617617begin
618618 SaveRibbonSettings(); // Save quick toolbar, etc.
619619 FFramework := nil ;
620- FreeAndNil(fRibbonMapper);
621620 FreeAndNil(FCommands);
622621 inherited ;
623622end ;
@@ -943,6 +942,8 @@ procedure TUIRibbon.Load();
943942begin
944943 if (Available) and (inherited Visible) and not (FLoaded) then
945944 begin
945+ // Load mapper for mapping between commands and VCL actions
946+ fRibbonMapper := TRibbonMarkupElementList.LookupListByResourceName(FResourceName);
946947 if (FResourceInstance = 0 ) then
947948 Inst := HInstance
948949 else
0 commit comments