Page 1 of 1
Multiple instances of RVAControlPanel / Copy paste issues
Posted: Fri Jun 19, 2020 3:36 pm
by krimsoniuss
When I have 2 instances of TRichviewEdit with RVAControlPanel connected to Speedbuttons on the same frame copy and pasting will only work on one of the RichViewEdits?
Maikel
Re: Multiple instances of RVAControlPanel / Copy paste issues
Posted: Fri Jun 19, 2020 9:59 pm
by Sergey Tkachenko
Several RVAControlPanels in the same applications are rarely needed. They are needed only if you need to apply different settings for different actions (for example, different UI language in different forms).
In other cases, I recommend using a single RVAControlPanel.
If you want a certain action to work with a certain editor, simply assign Action.Control := Editor. Similarly, assign Editor properties of combo boxes. RVAControlPanel is not necessary to specify the action's editor.
If you still want using several RVAControlPanel components, assign Action.ControlPanel := RVAControlPanel. If Action.ControlPanel = nil, the action uses the first created RVAControlPanel (which is not necessary on the same form/frame)
Re: Multiple instances of RVAControlPanel / Copy paste issues
Posted: Thu Mar 16, 2023 7:33 am
by gizmo
I've similar problem and can't deal with it.
I've got a frame with rvEdit:TRichViewEdit, RVAControlPanel1, RVAPopupMenu1 and ActionList1:
rvEdit.PopupMenu -> RVAPopupMenu1
RVAPopupMenu1.ControlPanel -> nil
RVAControlPanel1.DefaultControl -> rvEdit
Actions (for example rvActionPaste1):
.Control -> rvEdit
.ControlPanel -> RVAControlPanel1
When I put several frames on form only one of them gets ctrl+v.
How to set properties up to work well?
The code of the frame is attached to this message.
Still using v17.6. I already bought an update and preparing to switch.
Re: Multiple instances of RVAControlPanel / Copy paste issues
Posted: Thu Mar 16, 2023 9:13 am
by Sergey Tkachenko
Your settings are correct: the action work with the editor on the same frame.
However, you put several frames on the same form, so this form has several actions with the same shortcut.
When the user presses this shortcut, only one (first found) action is executed. This is how VCL works.
What do you want to implement? Inserting in all editors on Ctrl+V? This is not a standard behavior and it requires a special implementation.
Re: Multiple instances of RVAControlPanel / Copy paste issues
Posted: Thu Mar 16, 2023 10:02 am
by gizmo
Thanks Sergey for quick answer.
I want to use TRichViewEdit as a replacement for standard VCL memo/edit. Because TRichView needs some additional non-visual components as Style, PopupMenu, ActionList etc, I created a frame which I put of forms.
So the solution is to have one ControlPanel, ActionList etc on the form or application? How to connect actions to focused edit while the focus is changing?
Re: Multiple instances of RVAControlPanel / Copy paste issues
Posted: Thu Mar 16, 2023 11:22 am
by Sergey Tkachenko
I suggest removing actions and TRVAControlPanel from the frame and adding them to the main form.
In a frame, process OnEnter event of the editor and assign
Code: Select all
MainForm.RVAControlPanel1.DefaultEditor := TCustomRichViewEdit(Sender);
If your form has only TRichViewEdits, you can leave DefaultEditor unassigned, and the actions will work with the focused TRichViewEdit automatically. However, if the form has other focusable controls, assigning DefaultEditor is useful, to make sure that actions work with the last focused editor.
---
A special set of actions and TRVAControlPanel for each editor would be useful if you want to display multiple toolbars on the same form, one toolbar for each editor. But in this case you nned to handle shortcuts specially to make sure that they work with the focused (or last focused) editor.
Otherwise (you do not have toolbars or you have a common toolbar for all editors) I recommend to use a single TRVAControlPanel component and one common set of actions.
Re: Multiple instances of RVAControlPanel / Copy paste issues
Posted: Fri Mar 17, 2023 5:58 am
by gizmo
Thank you for your support. Your solution works fine.