Cut,Copy,Paste menus

Jan Schenkel janschenkel at yahoo.com
Sat Feb 1 05:30:00 EST 2003


--- Ron <rbarber at yhb.att.ne.jp> wrote:
> Hi Jan
> Thanks for the suggestion. I've included the
> handlers as they were in my
> stacks. As you can see, the menuitems only get
> changed when the menubar is
> clicked in. I'll look into locating some of the
> script in the
> selectionchanged message. What do you think?
> 
> >> Where should scripts that control the
> >> enabling/disabling of menuitems be
> >> placed? Obviously, the menu's mousedown message
> is
> >> not the place because it
> >> is not activated until I click in the menubar.
> >> 
> >> All I'm trying to do is provide standard text
> editor
> >> behavior to the stack.
> >> Things including but not exclusively:
> >> 
> >> cursor in a fld - enable past
> >> selectedtext - enable cut,copy
> 
> > 
> > You could add openField and selectionChanged
> handlers
> > to your mainStack script to this effect.
> > You'll probably also want to trap the rawKeyDown
> > message because no selectionChanged is sent when
> you
> > use the arrowkeys.
> 
> This is what I had in my openfield handler:
> on openfield
>   enable menu 2 --the edit menu
>   if the clipboard is "text" then enable menuitem 4
> of menu 2 --paste
>   else disable menuitem 4 of menu 2
>   put word 2 of the selectedfield into thefld
>   if therefld is not "" then put fld thefld of the
> topstack into thetext
>   if thetext is not "" then  --check if text is in
> the fld
>     enable menuitem 6 of menu 2 --sel all
>     enable menuitem 8 of menu 2 --find
>     enable menuitem 8 of menu 1 --export text
>     enable menuitem 11 of menu 1 --print text
>   end if
>   enable menu 4 --format menu
>   pass openfield
> end openfield
> 
> [snip]

Hi Ron,

Glad to see you're making progress. Though some of it
could be simplified by using 'the target' and 'the
selection', it is the way to go for you :-)
Under Windows or any of the Un*xes you could have
moved the 'mouseDown' handler into a 'mouseEnter'
handler ; but as menus are a different animal in
MacOS, that message probably wouldn't be sent (though
I can't check that right now).

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the use-livecode mailing list