Cascading Option Menus

Peter Haworth pete at mollysrevenge.com
Wed Feb 2 13:59:59 EST 2011


Thanks, I think I still have problems though.

If the submenu items were constant values, the menuhistory would work, but the menu choices will be built dynamically when the user clicks on the option menu button so the menuhistory won't be fixed for any particular submenu item. 

The menu tagging feature sounded like it might save me since I could use tags included the main menu item name in the tag as well as the subitem name.  But when I use the format in Jan's writeup, the menu choices are displayed to the user and returned by menuPick as the label, the "|" and the tag.    I'm sure I'm using the correct format per Jan's writeup so despite what he says about tags working for any type of menu, I don't think they work for option menu buttons.

My current plan is to search back through the text of the option menu button from the menuHistory line until I find a line with no tab in it so I know which main menu the submenu came from.

I can deal with that workaround but what bugs me is that, yet again, the dictionary is wrong. I'm at a point where I don't trust the dictionary information as being either correct or complete.  The LC folks should be so grateful to the people on this list who take the time to educate newer users like myself.

Pete Haworth

On Feb 2, 2011, at 10:15 AM, dunbarx at aol.com wrote:

> Pete:
> 
> 
> There should be no issue here.
> 
> 
> In a cascade menu put:
> 
> 
> 
> AA : BB
>      CC
>      DD
> EE : BB
>     CC
>     DD
> FF
> 
> 
> 
> You will want to get the menuHistory in order to distinguish between the redundant choices:
> 
> 
> 
> on menuPick pItemName
> put pItemname && the menuhistory of me
> end menuPick
> 
> 
> I got this from 
> Jan Shenkel wrote a nice description of "menu tags", which I append here:
> 
> 
> 
> Well, rev 3.5 introduced something called menu 'tagging' - here's a copy from the IDE change log included with rev 3.5
> 
> 
> --===
> 
> 
> --Menu-item tagging
> --~~~~~~~~~~~~~~~~~
> 
> 
> --The menu item specification has been extended to allow a tag to be specified. It is now of the form:
> --  <label> [ '/' [ <accelerator> ] [ '|' <tag> ] ]
> --Note that the <tag> is optional as is the <accelerator> however, if you want an item with a tag but without the accelerator you need:
> --  <label> '/' '|' <tag>
> 
> 
> --The <tag> must only be composed of characters from the ASCII character set.
> 
> 
> --If a menu item has a <tag> then it is the tag string that is passed to menuPick rather than the <label>. This is useful for localization of menu items as you don't need to change the menuPick handler for each language supported.
> 
> 
> --The following tags should be used to label the standard edit menu items to enable them to be controlled by the system dialogs on Mac OS X (e.g. answer file, ask file etc.):
> --  undo, redo, cut, copy, paste, clear, select all, preferences
> 
> 
> --Note: You should not mix the use of tags and no tags in Unicode menus. Doing so will cause empty values for all unicode items without tags.
> 
> 
> --===
> 
> 
> --Even though it sounds like it's only for "menubar" menus, tagging works for any type of menu. So you can use this knowledge to make the text:
> 
> 
> --My Silly Name That I Reuse For Everything/|1
> --My Subgroup/|2
> --<tab>My Silly Name That I Reuse For Everything/|3
> --My Silly Name That I Reuse For Everything/|4
> 
> 
> --And then your menupick will automagically get the 'tag' value as the line number; of course with sub-menus, you get a pipe-delimited list of tags, with the entire hierarchy.
> 
> 
> --So assuming that you change the text of your menu to the above style, your script could be something like:
> --##
> --on menuPick pItemTag
> --  set the itemDelimiter to "|"
> --  put the last item of pItemTag into tLineNumber
> --  ...
> --end menuPick
> --##
> 
> 
> --Menu tags also greatly simplify multilingual apps, as we can now just tag the items in our preferred language (or english, for consistency with the MacOSX presets) and work with the tag in our scripts.
> 
> 
> --Jan Schenkel
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Peter Haworth <pete at mollysrevenge.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Sent: Wed, Feb 2, 2011 12:37 pm
> Subject: Cascading Option Menus
> 
> 
> The recent thread on mouseDoubleup and particularly Richard's thought on HIG 
> have made me realise the UI choices I made weren't the best.  I'm now thinking 
> of using a cascading option menu.
> 
> The menuPick dictionary entry says "If the menu item is part of a submenu, the 
> menu item label is followed by a vertical bar (|) and the submenu's label."
> but what I'm seeing is just the actual submenu choice with tabs at the front of 
> it.  
> 
> I don't think I can make this work since I could have the same submenu item 
> listed under more than one main menu item.  What am I missing?
> 
> This is all on a Mac.
> 
> Pete Haworth
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> 
> =
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list