Here is a little code snippet (for beginners) in case someone needs to allow users to select text and copy the selected text, but not allow any changes to the text, or depending on allowing a rawkey number to be passed but only within a certain range.
This is often needed when a data record is loaded in "Data Browse" mode.
Code: Select all
on rawkeydown k
if the controlkey is down then
if k = 99 then -- k = 99 is the key "c"
set the clipboarddata["text"] to the selectedtext
end if
end if
end rawkeydown
Code: Select all
## Allow users to copy locked text using mouseDown
/* Script of a text field (or behavior, or group, card, stack...)
The field's 'locktext' property is set to true.
A locked field receives "mouseDown/mouseUp" messages. */
on mouseDown
set the clipboarddata["text"] to the text of me -- or 'the target', or give the name or id of the field
end mouseDown