Clipboard Copy Troubles?

Bob Sneidar bobsneidar at iotecdigital.com
Fri Sep 15 16:46:56 EDT 2023


Since I use my own menus, I had to create my own Edit menu. Here is the text of the edit menu and the scripting. This is actually a behavior I assign to all my Edit menu buttons. Replace the value for cHomeStack with the name of your own home stack. Note that you can add additional menu items to the text of the menu, then add a customMenuPick handler to the actual button script to process them.  

Cu&t/x
&Copy/c
&Paste/v
C&lear/b
Select &All/a
-
Settings...


constant cHomeStack = "Forms Generator"

on menuPick pItem
   put homeStack() into tMainStack
   put the selectedChunk into tChunk
   put value(tChunk) into tText
   put word -2 to -1 of tChunk into tTarget
   put the selectedObject into tRealTarget
   
   if word 1 of tTarget is "field" then
      put (the traversalOn of tTarget) and not (the locktext of tTarget) into tAllowEdits
   end if
   
   switch pItem
      case "Cut"
         if tText is not empty then \
               set the clipboardData ["text"] to tText
         
         if tAllowEdits then
            put "put empty into" && tChunk into tCommand
            do tCommand
         end if
         break
      case "Copy"
         if tText is not empty then \
               set the clipboardData ["text"] to tText
         break
      case "Paste"
         if tAllowEdits and the clipboardData ["text"] is not empty then \
               put "put the clipboardData [text] into" && tChunk into tCommand
         do tCommand
         break
      case "Clear"
         if tAllowEdits then \
               put "put empty into" && tChunk into tCommand
         do tCommand
         break
      case "Select All"
         try
            select char 1 to -1 of tTarget
         end try
         
         break
      case "Find"
         if there is a field "FindBar" then focus on field "FindBar"
         exit to top
         break
      case "Settings..."
         if there is a card "Settings" of stack me then
            go card "Settings" of stack me
         else
            go card "Settings" of stack homeStack()
         end if
         
         break
      default
         dispatch "customMenuPick" to me with pItem
   end switch
   
   pass menuPick
end menuPick

on customMenuPick pItem
   Return empty
end customMenuPick

getProp displayName
   -- code
   return "Sly Edits"
end displayName

function homeStack
   put "stack" && quote & cHomeStack & quote into tMainStack
   return tMainStack
end homeStack



> On Sep 15, 2023, at 12:02 PM, Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Heyall,
> 
> Just wondering if anyone else has experienced issues where livecode stops
> being able to copy to the clipboard when using copy command from the menu
> or CTRL C or right click copy
> Specifically from within the script editor or a variable window.
> A LC restart seems to solve this temporarily.
> I've noticed this recently more than usual.  On both mac and windows 11.
> 
> Does this ring a bell to anyone?
> 
> Thanks,
> 
> Tom
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list