Page 1 of 1

Prevent users from pasting text into a field

Posted: Thu May 23, 2013 12:42 pm
by Proct0r
Hi all,

Hoping somebody will have a cunning way to prevent anything from happening when a user presses Ctr+V in a field and maybe also the right-click context menu paste too.

Guessing it will having something to do with a key press message but not sure which is the most appropriate to use, any help would be appreciated thanks!

Re: Prevent users from pasting text into a field

Posted: Thu May 23, 2013 1:08 pm
by Klaus
Hi Proct0r,

you can add a "dummy" PASTEKEY handler to the field:

Code: Select all

on pastekey
   ## NADA!
   ## If you do not:-> pass pastekey
   ## then nothing will happen and that's what we want!
end pastekey
Hint:
From the dictionary about "pastekey":
...
Comments:
The LiveCode development environment traps the pasteKey message, unless "Suspend LiveCode UI" is turned on in the Development menu.
This means that the pasteKey message is not received by a stack if it's running in the development environment.
...

Best

Klaus

Re: Prevent users from pasting text into a field

Posted: Fri May 24, 2013 11:39 am
by Proct0r
Awesome, thanks for your help :)