Copy and paste standalone on a Mac

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Copy and paste standalone on a Mac

Post by bergsy » Fri Mar 27, 2015 4:39 am

Hi,

I have a standalone app. On a Mac, the command-C function (copy text) doesn't work, yet command-V does. When running under the IDE it works fine

The standalone PC version doesn't work either - also works fine in the IDE

Any ideas on what I am doing wrong appreciated

Cheers

Bergsy

bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Re: Copy and paste standalone on a Mac

Post by bergsy » Fri Mar 27, 2015 5:20 am

Seems that by default text fields have the "share text" option turned off. Turning it on solves the problem

bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Re: Copy and paste standalone on a Mac

Post by bergsy » Fri Mar 27, 2015 5:37 am

Spoke too soon - works on a PC now but not on a Mac. Command-C does nothing

bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Re: Copy and paste standalone on a Mac

Post by bergsy » Fri Mar 27, 2015 7:53 am

Just to be clear, I am trying to copy test from a text field and paste to a text field

Thanks

Bergsy

Klaus
Posts: 14188
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Copy and paste standalone on a Mac

Post by Klaus » Fri Mar 27, 2015 3:17 pm

Hi Bergsy,

maybe that (standalone) stack is password protected?
That will prohibit copying anything FROM that stack.


Best

Klaus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Copy and paste standalone on a Mac

Post by FourthWorld » Fri Mar 27, 2015 4:10 pm

I believe password protection only prohibits the copying objects, since objects can contain protected scripts. Copying text should be fine.

Bergsy, what does your commandKeyDown handler look like?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Re: Copy and paste standalone on a Mac

Post by bergsy » Sat Mar 28, 2015 10:55 am

Hi Fourthworld,

My commandKeyDown looks like this. I trap Ctrl-F to toggle fullscreen, otherwise I pass it on

on commandkeyDown theKey
if theKey = "f" or theKey = "F" then
put the short name of this stack into tStackName
put the fullscreen of this stack into bFullScreen
if bFullScreen then
--centerMe
set the fullscreen of this stack to not bFullScreen
set the height of this stack to gScreenParameters[tStackName][“height”]
set the width of this stack to gScreenParameters[tStackName][“width”]
set the top of this stack to gScreenParameters[tStackName][“top”]
set the left of this stack to gScreenParameters[tStackName][“left”]
set the loc of this stack to gScreenParameters[tStackName][“loc”]
else
put the height of this stack into gScreenParameters[tStackName][“height”]
put the width of this stack into gScreenParameters[tStackName][“width”]
put the top of this stack into gScreenParameters[tStackName][“top”]
put the left of this stack into gScreenParameters[tStackName][“left”]
put the loc of this stack into gScreenParameters[tStackName][“loc”]
set the fullscreen of this stack to not bFullScreen
end if
else
pass commandKeyDown
end if
end commandkeyDown

Cheers

bergsy

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Copy and paste standalone on a Mac

Post by FourthWorld » Sat Mar 28, 2015 2:44 pm

If you want to handle copy and paste you'll probably want to add those to your handler. A switch block can make that clean and easy, e.g.:

Code: Select all

on commandKeyDown k
  switch k
  case "c"
     copy
     break
  case "v"
     paste
     break
  case "f"
    -- fullscreen stuff goes here
    break
  default
    pass commandKeyDown
  end switch
end commandKeyDown
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Re: Copy and paste standalone on a Mac

Post by bergsy » Sun Mar 29, 2015 2:25 am

That did the trick Richard - thanks a heap

Wouldn't Livecode be better off implementing this as a basic feature, allowing people to turn it off if they don't want it? Particularly since it works under the IDE

Anyway, I really appreciate the help

Cheers

Bergsy

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Copy and paste standalone on a Mac

Post by FourthWorld » Sun Mar 29, 2015 4:05 am

It might seem basic, but LiveCode is used to make so many different kinds of apps that what needs to happen in response to command keys may not be as simple for others as it was for yours.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Re: Copy and paste standalone on a Mac

Post by bergsy » Tue May 26, 2015 3:03 am

Hi,

This solution works well, however I also want to implement Ctrl-A to select all text. Is there an equivalent command as there is for copy and paste?

Thanks for the help

Cheers

Greg

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Copy and paste standalone on a Mac

Post by jacque » Tue May 26, 2015 5:37 pm

Add a case to the switch:

Code: Select all

case "A" 
 if the selectedField is not empty then select the text of the selectedField 
 break
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bergsy
Posts: 45
Joined: Mon Oct 28, 2013 10:51 pm

Re: Copy and paste standalone on a Mac

Post by bergsy » Fri Jun 05, 2015 4:40 am

Thanks Jacque. Sorry for the delay - travelling

The Mac keysequences keep catching me out. "Shift-del" needs to backspace a character, the same as "delete". So I need to handle this as well

I will post this as a separate issues, so no need to reply here

Post Reply