Page 1 of 1

Copy and paste standalone on a Mac

Posted: Fri Mar 27, 2015 4:39 am
by bergsy
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

Re: Copy and paste standalone on a Mac

Posted: Fri Mar 27, 2015 5:20 am
by bergsy
Seems that by default text fields have the "share text" option turned off. Turning it on solves the problem

Re: Copy and paste standalone on a Mac

Posted: Fri Mar 27, 2015 5:37 am
by bergsy
Spoke too soon - works on a PC now but not on a Mac. Command-C does nothing

Re: Copy and paste standalone on a Mac

Posted: Fri Mar 27, 2015 7:53 am
by bergsy
Just to be clear, I am trying to copy test from a text field and paste to a text field

Thanks

Bergsy

Re: Copy and paste standalone on a Mac

Posted: Fri Mar 27, 2015 3:17 pm
by Klaus
Hi Bergsy,

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


Best

Klaus

Re: Copy and paste standalone on a Mac

Posted: Fri Mar 27, 2015 4:10 pm
by FourthWorld
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?

Re: Copy and paste standalone on a Mac

Posted: Sat Mar 28, 2015 10:55 am
by bergsy
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

Re: Copy and paste standalone on a Mac

Posted: Sat Mar 28, 2015 2:44 pm
by FourthWorld
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

Re: Copy and paste standalone on a Mac

Posted: Sun Mar 29, 2015 2:25 am
by bergsy
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

Re: Copy and paste standalone on a Mac

Posted: Sun Mar 29, 2015 4:05 am
by FourthWorld
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.

Re: Copy and paste standalone on a Mac

Posted: Tue May 26, 2015 3:03 am
by bergsy
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

Re: Copy and paste standalone on a Mac

Posted: Tue May 26, 2015 5:37 pm
by jacque
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

Re: Copy and paste standalone on a Mac

Posted: Fri Jun 05, 2015 4:40 am
by bergsy
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