Auto enable Cut, Copy, Paste menu items

Bill Vlahos bvlahos at mac.com
Thu Sep 14 01:09:24 EDT 2006


Oh now that is the most ridiculously, wonderfully, and embarrassingly 
easy thing to do.

Here it is:
on mouseDown -- Put in button "Edit" of menubar group of stack
   -- This example assumes text in fields not other clipboard types
   if the selectedText is empty then -- nothing selected
     disable menuItem 1 of me -- Cut
     disable menuItem 2 of me -- Copy
   else -- text is selected
     enable menuItem 1 of me -- Cut
     enable menuItem 2 of me -- Copy
   end if
   if the clipboard is "text" then -- Is there text in the clipboard?
     enable menuItem 3 of me -- Paste
   else -- Either no text in clipboard or data type of clipboard is not 
text
     disable menuItem 3 of me -- Paste
   end if
end mouseDown

Thanks Sarah.
Bill Vlahos

On Sep 13, 2006, at 6:34 PM, Sarah Reichelt wrote:

> On 9/14/06, Bill Vlahos <bvlahos at mac.com> wrote:
>> Does Rev have an automated way to manage the Edit menu items Cut,
>> Copy, and Paste?
>>
>> For example, it only makes sense for Cut or Copy to be enabled if
>> there is any text that is hilited. Another example, if there isn't
>> anything in the clipboard then there is nothing to paste. Even if
>> there is something on the clipboard there would have to be a match
>> for where it would be pasted. For example, if there is text in the
>> clipboard there would have to be an insertion point in a text field
>> for the paste to make sense.
>>
>> On a stack with lots of fields and cards it seems tedious to try to
>> manage all of the situations.
>>
>> I was hoping that this would be a common enough feature of every
>> program that Rev could manage it for me but I don't see it described
>> anywhere.
>>
>
> I don't think there is any automated way to do this, but managing it
> yourself is not too tedious if you just have a single routine for
> doing it that gets called from a mouseDown handler in the menubar
> group script.
>
> Cheers,
> Sarah
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution



More information about the use-livecode mailing list