Scripting Cut/Copy/Paste in custom menus
J. Landman Gay
jacque at hyperactivesw.com
Sat Sep 13 23:26:45 EDT 2014
On 9/13/2014, 7:55 PM, Bob Sneidar wrote:
> As many know, creating a custom menu set on OS X (not sure about
> Windows) will typically add the File and Edit menus to your customer
> menu set. This has the net effect of*disabling*
> cut/copy/paste/clear.
Not really. Did you use Menu Builder to set up the menu, and then click
"Auto-script"? That inserts a menuPick handler with a switch statement
all set up and ready to go, but without any specific commands. You have
to add those yourself. If you don't, you have an empty menuPick that
effectively blocks menu selections and keyboard shortcuts.
Also make sure you set the menubar of the stack to the name of the menu
group. I've not had any problems with menus as long as I do all that.
If you have access to the RevLive conference videos, I covered a lot of
this in my talk on menus.
> So what gets sent to the engine exactly that lets it know that the
> contents of a field have changed, so that tabbing out generates the
> proper closeField message?
I agree with Kay that we don't want the engine sending closefields for
us when scripts alter a field, and that's what textChanged is supposed
to help with. But in this case I'd probably write the instructions into
a separate handler, and then call that from the script that did the text
alterations, and also from a closefield handler. That way either method
will do the same thing. For example:
on closeField
doStuff
end closeField
And in some other handler somewhere:
put "xyz" into fld 1
doStuff
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list