At 12:49 PM -0500 1/17/2017, Paul Dupuis via use-livecode wrote:
For desktop applications on Windows and OSX, I am lookingf or what
people consider the best practice to be for enabling, disabling, or
updating menu items based on context.
You have so many ways in the LiveCode language to do this:
enable menuItem 2 of menu "Edit"
disable menuItem 3 or menu "File"
get the text of btn "Edit"
if first char of line 3 of it is "(" then delete first char of line 3 of
it -- enables 3 menuItem in Edit menu
set the text of btn "Edit" to it
enable menuitem 2 of btn "File" of grp "Menubar" -- Enable Open
One thing I like is using menu tags, rather than menu item numbers or
names, because that way you don't have to touch any code if you
change the position or text of a menu item. It makes life easier with
a menu item whose name changes based on context, because the tag is
invariant.
I do wish LC had menu items as pseudo-objects (that is, addressable
things with certain properties of their own, like chunks in fields).
It would make checking the status menu items so much easier if you
didn't have to mess with metacharacters in the actual text of a menu
item....
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode