Page 1 of 1

Copy/Paste controls

Posted: Mon Aug 17, 2009 11:54 am
by Verasoft
I'm using a TRichViewEdit to create an electronic forms editor.
I'm creating controls responding on OnRVFControlNeeded event.
When I'm inserting controls in code, all works as expected.
But when copying and pasting an control, the Name parameter of OnRVFControlNeeded is set to the name of control being copied. So after a copy/paste operation I'm getting two controls with identical RichView names.
The only one workaround I found is to patch the richview sources and allow modifying of the "Name" parameter in event procedure. Is there any way to do this without patching the sources? Any example?

TIA

Posted: Mon Aug 17, 2009 4:35 pm
by Sergey Tkachenko
You can use OnControlAction event (action = rvcaAfterRVFLoad).
Use TCustomRVData(Sender.Style.RVData).GetItemText(ItemNo) to get the control text, and SetItemText to change it.