windowmenu problem

Posted by Fiendish on Mon 22 Nov 2010 03:36 AM — 3 posts, 11,064 views.

USA Global Moderator #0
The current mechanism for returning the result of a hierarchical menu with name duplicates (i.e. starting with "!" to get a quasi-numerical return) is turning out to be rather troublesome for a use scenario I just attempted...

Here's what I tried to do:
There is a menu with two submenus, "Active" and "Inactive". Given a set of things, any given thing can be either active or inactive. Selecting an active thing would set it to be part of the inactive list, and vice versa. This presents a bit of a bookkeeping problem for the numerical return, since a given number could be any number of things.

At a given time you could have:

Active>
thing1
thing2
Inactive>
thing3
thing4

or you could have

Active>
thing2
thing3
Inactive>
thing1
thing4

I think a better system without this flaw would be to return the entire result path (e.g. "Active|thing2" or "Inactive|thing1")
Amended on Mon 22 Nov 2010 04:51 AM by Fiendish
Australia Forum Administrator #1
My problem is backwards compatibility. It would be great to design things in the first place to do exactly what you want (indeed, to solve future problems you haven't even thought of), but failing that you try not to break existing code.

A "helper" function could easily be written, and I don't doubt you could do it in 5 or so minutes, that would solve that problem for any generic menu. That is, it would notice which items are active and which are not, and based on the returned number, return the string that you request.

I anticipated you would have this sort of thing show up (with grayed out menu items) but was certain it could be solved.
Amended on Mon 22 Nov 2010 05:08 AM by Nick Gammon
USA Global Moderator #2
In any case I worked around it this time by restructuring things so that everything stays in one submenu.