Multiple instances of RVAControlPanel / Copy paste issues

General TRichView support forum. Please post your questions here
Post Reply
krimsoniuss
Posts: 7
Joined: Thu Apr 26, 2018 2:14 pm

Multiple instances of RVAControlPanel / Copy paste issues

Post 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
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Multiple instances of RVAControlPanel / Copy paste issues

Post 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)
gizmo
Posts: 5
Joined: Wed Sep 26, 2012 6:33 pm

Re: Multiple instances of RVAControlPanel / Copy paste issues

Post 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.
Attachments
UframeRVMemo.7z
(84.89 KiB) Downloaded 201 times
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Multiple instances of RVAControlPanel / Copy paste issues

Post 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.
gizmo
Posts: 5
Joined: Wed Sep 26, 2012 6:33 pm

Re: Multiple instances of RVAControlPanel / Copy paste issues

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Multiple instances of RVAControlPanel / Copy paste issues

Post 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.
gizmo
Posts: 5
Joined: Wed Sep 26, 2012 6:33 pm

Re: Multiple instances of RVAControlPanel / Copy paste issues

Post by gizmo »

Thank you for your support. Your solution works fine.
Post Reply