PDA

View Full Version : FormattedTextControl - Copy & Paste with formatting - Anyone interested?



jharp
August 10th, 2021, 05:08
Hello everyone,

I've added an extension to forge that allows copy and paste between formattedtextcontrols with the formatting preserved.

Available at: https://forge.fantasygrounds.com/shop/items/185/view

By default the tool copies the entire source formattedtextcontrol and appends the data at the end of the destination formattedtextcontrol. All of this is hot key triggered. The focus must be in the source when you copy and in the destination when you paste.

Due to the lack of selection support for formattedtextcontrol you can do subsections but it requires the use of some marker text to accomplish. I happen to use:

#FTS# - start position
#FTE# - end position
#FTI# - insert position (if you want it somewhere other than the end of the destination formattedtextcontrol


Releases
v1.0.7

Fix: Now finds formattedtextcontrols in refmanual builder.
Change: Added recursion check to finding of formattedtextcontrol with focus. FTCP aborts search path once it hits 5-levels deep.


v1.0.6

Changed: Moved the configuration of FTCopyPaste to the options menu under Ma's Tools.


v1.0.5

Fix: Focus unable to be found in certain cases.


v1.0.0

Initial release

jharp
August 28th, 2021, 00:52
Confirmed compatible with TEST channel ruleset changes along with new refmanual builder.
Confirmed compatible with v4.1.9
Confirmed compatible with v4.1.5

damned
August 28th, 2021, 02:57
Hah! Very good.
I do something like that in MoreCore and Player Agency but I never thought of using it for this purpose.

jharp
August 28th, 2021, 04:28
From you I take that as a great complement. Thank you.

Jiminimonka
October 31st, 2021, 16:28
Can you give a better example of "how to" please.

jharp
October 31st, 2021, 19:18
Can you give a better example of "how to" please.

1. Setup your hot keys by typing /FTCP copy in the chat panel. Then drag that text to a hot key. Do the same with /FTCP paste
2. With your focus and cursor in a Formatted Text Control that you wish to copy from, press the hot key that is set for /FTCP copy
3. With your focus and cursor now in a Formatted Text Control that you to copy to, press the hot key that is set for /FTCP paste

Bingo done. The copied area is appended to the paste area.

However, if you need to only copy a portion of the source then you must modify the source Formatted Text Control text area by inserting some markers. So in the source Formatted Text Control, insert #FTS# on a line by itself above the area you wish to copy. Insert #FTE# on a line by itself below the area you wish to copy. So it will copy the area between the two markers. Paste as normal.

If you wish to paste in a specific location then insert the marker #FTI# on a line by itself to indicate where the paste should occur. Paste hotkey and it will remove the marker and insert the text from the copy.

There are two convenience functions that you can set to hotkeys if you wish. They are

/FTCP itop - inserts a newline at the top of the control to aid in placing markers
/FTCP ibot - inserts a newline at the bottom of the control to aid in placing markers

These let you get a newline to place markers if required.

Let me know if you need anything else,

Jason

Jiminimonka
November 1st, 2021, 21:46
1. Setup your hot keys by typing /FTCP copy in the chat panel. Then drag that text to a hot key. Do the same with /FTCP paste
2. With your focus and cursor in a Formatted Text Control that you wish to copy from, press the hot key that is set for /FTCP copy
3. With your focus and cursor now in a Formatted Text Control that you to copy to, press the hot key that is set for /FTCP paste

Bingo done. The copied area is appended to the paste area.

However, if you need to only copy a portion of the source then you must modify the source Formatted Text Control text area by inserting some markers. So in the source Formatted Text Control, insert #FTS# on a line by itself above the area you wish to copy. Insert #FTE# on a line by itself below the area you wish to copy. So it will copy the area between the two markers. Paste as normal.

If you wish to paste in a specific location then insert the marker #FTI# on a line by itself to indicate where the paste should occur. Paste hotkey and it will remove the marker and insert the text from the copy.

There are two convenience functions that you can set to hotkeys if you wish. They are

/FTCP itop - inserts a newline at the top of the control to aid in placing markers
/FTCP ibot - inserts a newline at the bottom of the control to aid in placing markers

These let you get a newline to place markers if required.

Let me know if you need anything else,

Jason

Cool, thanks.

Jiminimonka
November 2nd, 2021, 22:07
Confirmed compatible with TEST channel ruleset changes.
Confirmed compatible with v4.1.9
Confirmed compatible with v4.1.5

Update to work with latest TEST build coming soon? Especially with the Reference Manual Tools :)

jharp
November 2nd, 2021, 22:14
I can't see why it wouldn't work but I'll take a look at the reference manual area and confirm.

Edit: Most certainly does not work in the Ref Manual tools so I'll try to fix that today.

Jason

Jiminimonka
November 2nd, 2021, 22:31
I can't see why it wouldn't work but I'll take a look at the reference manual area and confirm.

49775

Getting this error. Which I should have posted initially. Thanks

jharp
November 2nd, 2021, 23:40
1.0.7 is submitted with fix for reference manual builder.

Jiminimonka
November 2nd, 2021, 23:43
1.0.7 is submitted with fix for reference manual builder.

Thanks!