Copy/Cut/Paste Edit Menu Questions?

David Burgun dburgun at dsl.pipex.com
Sat Apr 22 06:38:41 EDT 2006


On 21 Apr 2006, at 20:25, Garrett Hylltun wrote:

> David Burgun wrote:
>> Hi,
>> I've noticed that the copy/cut/paste commands work automatically  
>> when you use the Command-Key short cuts, e.g. if you have an Text  
>> Field and you select the text within it, you can copy or paste  
>> into that field. This seems to work in the IDE and in the  
>> Standalone. My first question is how/where is this action handled?  
>> Can I stop this action happening on certain fields?
>
> In the docs, check out
>
> * copyKey message
> * cutKey message
> * pasteKey message
>
> Example:
>
> on cutKey
>   cut
> end cutKey


Thanks, I must have missed these somehow.

> use the the following (using either IF statements or CASE  
> statements) handler in the code for the menu object:
>
> on menuPick varSelected
>   if varSelected is "Cut" then
>     focus field "editfieldnamehere"
>     cut
>   else if varSelected is "Copy" then
>     focus field "editfieldnamehere"
>     copy
>   else if varSelected is "Paste" then
>     focus field "editfieldnamehere"
>     paste
>   end if
> end menuPick
>
> > from the Edit Menu? And how can you disable/enable the edit menu  
> items
> > depending on which control has been selected?
>

I should have asked the question differently! What I meant to say  
was, in a menu handler, how can I tell which field is the current  
field, and how can I enable/disable Edit Menu Items based on whether  
a field is selected or not? Do I need to put an openField/closeField  
handler on each text field and then enable/disable there?

All the Best
Dave












More information about the use-livecode mailing list