André, Pete, This script just works with the currently selected text and will work in a stack without a menu, it's not perfect, but could be a useful starting point, I think it should work OK with a DG too.
Paul ## Paste into the Main Stack script on commandKeyDown pKey switch pKey case "c" if the selection is not empty then set the clipboardData["text"] to the selection break case "x" if the selection is not empty then set the clipboardData["text"] to the selection put empty into the selection end if break case "v" if the clipboardData["text"] is not empty then put the clipboardData["text"] into the selectedText break case "a" select text of the focusedObject break case "z" undo break default pass commandKeyDown end Switch end commandKeyDown On 2012-07-14, at 6:15 PM, Peter Haworth wrote: > Hi Jacque, > I'm not 100% sure but I don't think he has a menu script right now. > > Your handler works fine of course. However, when I tried that simplistic > approach in my SQLiteAdmin program, it was politely pointed out to me by a > customer that the availability of cut/copy/paste/clear commands should be > dependant on the cursor being in a control where they make sense. > > In my case, only text was involved but I ended up adding code that detected > whether the current control was a field or not and enabling/disabling the > controls appropriately. Oh yes, and also enabling/disabling, the > paste/undo command depending on whether there was any text on the > clipboard. It could get more complicated if you wanted to cut/copy out of > something like a datagrid. > > Pete > lcSQL Software <http://www.lcsql.com> > > > > On Sat, Jul 14, 2012 at 12:23 PM, J. Landman Gay > <jac...@hyperactivesw.com>wrote: > >> There were some changes made in the engine to allow additional menu item >> parameters, but the command keys should still work. If they don't, try >> changing your menu group into a shared card group instead of a background >> group. That way they are more likely to receive keyboard input. >> >> If that still doesn't work, the handler to catch copy/paste is very simple: >> >> on commandkeyDown pKey >> switch pKey >> case "x" >> cut >> break >> case "v" >> paste >> break >> case "c" >> copy >> break >> case "z" >> undo >> break >> default >> pass commandKeyDown >> end switch >> end commandkeyDown >> > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode