Copy/Cut/Paste Edit Menu Questions?

Martin Baxter mb.ur at harbourhost.co.uk
Sat Apr 22 07:06:26 EDT 2006


David Burgun wrote:
> 
> 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

Dave,

I use the focusedobject in my edit menus to determine whether the 
selected object is one of the objects where I want to allow copy/paste 
etc.. I have a list of allowed objects that I compare it to.

Martin



More information about the use-livecode mailing list