copy-paste not working in a standalone
André Bisseret
andre.bisseret at wanadoo.fr
Sun Jul 15 03:50:01 EDT 2012
Nice !
Thank you very much Paul
I was looking for a way to make a menu that could be common to several hundred of stacks (mains stacks!!)
Don't know if it is possible.
Fortunately, in my app. these stacks have no scripts at all ; more precisely all the scripts are in behaviors (one for the stack script and one for each of the 3 types of card) which are in a central main stack.
So I have just to add such a script (like yours or that of Jacques) and it will be immedialely working on all the stacks!
André
Le 15 juil. 2012 à 08:42, Paul Hibbert a écrit :
> 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
>> <jacque at 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
>>>
More information about the use-livecode
mailing list