Mobile Clipboard?
Mark Talluto
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.
on inputTextChanged
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
end repeat
else
//SUPPORT ENTER ONE CHAR AT A TIME
if tText is false then
//PUT EMPTY INTO INPUT FIELD
mobileControlSet tTarget, "text", ""
else
//GO TO NEXT INPUT FIELD
put getNextIOSinputField(tTarget) into tTarget
mobileControlDo ("appCode" && tTarget), "focus"
end if
end if
end inputTextChanged
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.
Best regards,
Mark Talluto
appli.io <https://appli.io/>
livecloud.io <https://livecloud.io/>
nursenotes.net <https://nursenotes.net/>
canelasoftware.com <https://www.canelasoftware.com/>
More information about the use-livecode
mailing list