Edit menu recipe?

Frank Leahy frank at backtalk.com
Sat Aug 21 06:50:15 EDT 2004


On Aug 20, 2004, at 5:00 PM, use-revolution-request at lists.runrev.com 
wrote:

> From: "J. Landman Gay" <jacque at hyperactivesw.com>
> Subject: Re: Edit menu recipe?
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <4126198C.4050605 at hyperactivesw.com>
> Content-Type: text/plain; charset=us-ascii; format=flowed
>
> On 8/20/04 7:19 AM, Frank Leahy wrote:
>
>> Does anyone have an edit menu recipe they'd like to share?  I've got 
>> one
>> that works for the main stack, but doesn't seem to work for other
>> stacks.
>
> My Edit menus tend to be very simple most of the time, because the
> functionality I usually need is is already built in. It looks like all
> you are working with is text; if that is the case, then you don't need
> to do any more than this:
>
> on menuPick which
>    switch which
>    case "Cut"
>      cut
>      break
>    case "Copy"
>      copy
>      break
>    case "Paste"
>      paste
>      break
>    case "Undo"
>      undo
>      break
>    case "select all"
>      if the selectedField <> ""
>      then select text of the selectedField
>      break
>    end switch
> end menuPick
>
> The engine automatically handles all the text operations. If you want 
> to
> manage the editing of objects, then it gets more complicated. But not
> many apps need to do that, and it looks like all you need is text
> manipulation.
>

Jacqueline and Rob,

Many thanks for the suggestions.  I tried yours Jacqueline, and while 
it came close, I had problems with paste in particular where the 
selection point after the paste was in the wrong place (it was before 
the pasted data instead of after it).  Not sure why that was, I gave up 
and re-rolled my own.

The other thing that's interesting is that "the selectedChunk" was 
reporting the wrong field number for me (it would return field 21 when 
it should have been field 12 or field 14).  I don't know if this is a 
known bug, or whether it's just because of something I'm doing, but I 
had to use the first part of the selectedChunk -- "char 1 to 2 of" -- 
and then append "the focusedObject" to get the correct selectedChunk 
value.  Weird but true.

Anyway, it's all working now...thanks again.

-- Frank



More information about the use-livecode mailing list