You assume that actions use TRVAControlPanel component (and thus its DefaultControl property) placed on the same form.
This is a wrong assumption. Properties of RVAControlPanel only provide access to global variables, so several instances of this component change the same variables.
If you want to link specific actions to the specific editor, you should do it using action.Control property.
Place this code in TfrmMain.FormCreate:
Code: Select all
for i := 0 to ComponentCount-1 do
if Components[i] is TrvAction then
TrvAction(Components[i]).Control := RichViewEdit1;
Besides, it's better to move RVAControlPanel1 to Form1 to provide that this component is created in a single instance.
Note 1: If you use multiple forms, you need to change code that changes measuring units (TfrmMain.cmbUnitsClick). Changing RVAControlPanel1.UnitsDisplay affects all forms. So you need to change UnitsDisplay for all rulers on all forms, change MarginsUnits for all rvActionPageSetup1 on all forms, call RVA_ConvertToPixels/RVA_ConvertToTwips for all forms, call ConvertDocToDifferentUnits for RichViewEdit1 and RVStyle1 on all forms.
Besides, when a new form is created, if RVAControlPanel1.UnitsDisplay=twips (i.e. it was changed in one of previously created forms), and if yes, update the form accordingly.
Note 2: consider using a single editing form with editor switched on tabs instead of multiform approach. A demo (with classic toolbar) is here:
http://www.trichview.com/support/files/ ... sttabs.zip
In this case, you can use a single ribbon and a single set of actions for multiple editors.
Note 2: in the next update, internal implementation of TRVAControlPanel will be completely rewritten, it will not use global variables; you will be able to link specific actions to specific RVAControlPanel, so, for example, different forms can use different measuring units.