I have 2 forms which I'd like to share one single TActionManager
and assigned TAction
-s.
First form is main form - it holds TActionManager
, TAction
with caption "Action".
Main menu of Form1 has this action and menuitem caption property set to "Action A". Form2 includes Form1 and also assigns action to menuitem and caption is set to "Action B".
During design time everything looks good - menu items are named "Action A" and "Action B" in Form1 and Form2 and same action is assigned. It also works fine during runtime (OnExecute is properly processed for both forms).
However - during runtime, Form1 menu item has caption "Action A" and Form2 has menu item caption "Action" just like the action caption.
Am I including them incorrectly, is it possible to include Form1 on Form2 to share action and to change caption? Is it a bug in D2010 / CB2010?
Example:
I reproduced your issue and indeed, this is strange behaviour. Besides the obvious question why to change the menu items captions, the following should work:
Set both menu item's Action
property to the same action. Now the captions of the menu items are linked to that of the action and note that they are not stored any longer (they appear not bold in the object inspector). Subsequently, change the captions from the menu items to independent values, and note that they now are stored and that the menu items indeed change accordingly at designtime.
But at runtime, the caption of the second menuitem indeed follows that of the action again. This should not happen in my opinion.
What I did not reproduce is the inabbility to change it at runtime. The following works as expected (D7 here):
procedure TForm2.FormCreate(Sender: TObject);
begin
mnuAction1.Caption := 'Action B';
end;
Sure you are changing the caption of the menu items instead of that of the action?