Select all content textbox

Get help using Construct 2

Post » Fri Nov 20, 2015 12:28 pm

How to select all content that is in the textbox?

1 - Click a button to select all the text.

2 - Another button to copy the selected text


Image

:D
B
17
S
1
Posts: 89
Reputation: 1,259

Post » Fri Nov 20, 2015 1:10 pm

On "copy text button" pressed then copy = textbox.text

Will copy all of the text in the textbox into a variable called copy.

Copying only some of the text would be more difficult…
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,782

Post » Fri Nov 20, 2015 4:54 pm

derikvlog wrote:1 - Click a button to select all the text.

2 - Another button to copy the selected text

If you mean...copy to clipboard
like:
Image
First you need custom ID for Text Box
Image
then ..you can write something like*:
Browser Execute Javascript-
"document.getElementById(""myText"").select();document.execCommand('copy');"

Image

now you can paste selection to text file on your computer..or..

CopyText.capx

*=probably not the best code..I tested this only in last Chrome..just search net for "javascript&copy to clipboard"....
Image
B
63
S
23
G
7
Posts: 1,475
Reputation: 10,776

Post » Sat Nov 21, 2015 12:33 am

Thanks
B
17
S
1
Posts: 89
Reputation: 1,259

Post » Sat Nov 21, 2015 7:39 am

I never even thought of copying to the clipboard, which is lucky as I had no idea how to do it anyway :)

Thanks again @korbaach
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,782


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 2 guests