Best practice for menus...

Jeanne A. E. DeVoto revolution at jaedworks.com
Tue Jan 17 16:54:16 EST 2017


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....




More information about the use-livecode mailing list