mark at canelasoftware.com
Fri Dec 23 02:41:41 EST 2022
On Fri, Dec 16, 2022 at 10:54 AM Richard Gaskin via use-livecode <use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>> wrote:
Dan Friedman wrote:
> Is there a way to set the clipboard text on a mobile (iOS and Android)
> device? Something equivalent to "set the clipboardData to someText"?
Unless there's been a very recent change, I don't believe LC-made mobile
apps can use the clipboard at all outside of user interactions within
scripted instantiations of mobile-native fields.
Do we have any word from the team on when this will be added?
Livecode apps for mobile devices take advantage of the host OS clipboard. You have to use the native input fields to access the clipboard.
Here is some sample code from the Appli Player, where one would paste in an app code to access a project.
This assumes you are using the version of the input field where you build it yourself vs. dragging the input field from the toolbox.
local tTarget, tText
//VALIDATE THE ENTRY
put mobileControlTarget() into tTarget
put mobileControlGet(tTarget,"text") into tText
put validateAppCodeInput(tText) into tText
//SUPPORT PASTE FROM CLIPBOARD
if the num of chars of tText = 9 then
repeat with xChar = 1 to 9
if xChar = 5 then next repeat --SKIP HYPHEN
mobileControlSet gMobileAppCodeFieldIDa[xChar], "text", char xChar of tText
//SUPPORT ENTER ONE CHAR AT A TIME
if tText is false then
//PUT EMPTY INTO INPUT FIELD
mobileControlSet tTarget, "text", ""
//GO TO NEXT INPUT FIELD
put getNextIOSinputField(tTarget) into tTarget
mobileControlDo ("appCode" && tTarget), "focus"
Due to challenges with this method of the input field for Android, we settled on using the input field from the toolbox.
In that case, you would pick up the clipboard as you would for a desktop. This is from memory. Let me know if there are problems, and I’ll dig deeper.
More information about the use-livecode