VB6 Menu Problem

Background:
In my VB6 MDI application, the MDI form has quite a few menus. There are 10 main menus, each with up to 8 or so submenus. In several places, some of those submenus contain submenus of their own. So at most the menus nest to three levels.
When the user selects a menu item, I disable certain other menu items that can't be available while the user is "in" the menu (most of the menus open a child form). When the user closes from the form involved, I enable the menus I disabled. It can get quite complex because when one menu is entered, several get disabled, but there are others that remain available. If the user selects one of those, I disable the appropriate items for that selection, taking into account whether they have been disabled by a previous selection. I accomplish this with a dynamic array that keeps track of what menus are disabled by what other menus. It all works really well.
However I have a problem. Sometimes I run into a runtime error because you can't disable all of the visible submenus for a menu. It makes sense, of course, otherwise you could choose a menu and see all disabled options, which isn't good form.
My latest solution is to model the menu structure completely in an array. I perform the changes on the array when enabling/disabling menus, then check for the error situation and disable the parent menu if all of its submenus are disabled. I then have to carefully apply the changes from the array to the actual menus on the form. The best I can do has me looping through all those menus 3 times. This is because I can't disable all submenus and then disable the parent menu. I have to do the parent(s) first. All in all, it is too complex, slow and isn't satisfactory.

Questions:
1. Anyone had this problem before? Is there a "standard" solution to this I have never seen?
2. Should I go entirely another way? - I've been toying with generating the entire menu structure dynamically at runtime - that way, instead of enabling/disabling menu items, I can re-generate only the available ones. Doesn't sound very GUI-compliant, though.
3. Anyone know of a robust active-x menu control that doesn't have this limitation? (this is a commercial app I'm writing, the component has to be tried and tested).
Thanks
Zukes
ZukesAsked:
Who is Participating?
 
ashooooConnect With a Mentor Commented:
Disabling the parent menu is not a good idea. And its not standard too.
0
 
fantasy1001Connect With a Mentor Commented:
Why don't set the popup form in modal mode, in which the user cannot access at all the menu,
0
 
clanglConnect With a Mentor Commented:
Can you instead of disabling them make the visible property false?  Just a thought.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Dang123Connect With a Mentor Commented:

I forget where I read it, but a few people suggest not disabling menu options, instead put up a message box when a menu item is used when it shouldn't be. The message box should describe when the item is really available. This is supposed to prevent confusion for the non PC-literate as the menu system won't change constantly and the user can find out exactly how to get a menu item active ( A quote from one of my users trying Word went something like this once "Now why can't I cut this paragraph!!?? My blinking thing is in it!!!")

Doing this, would also prevent your problem of having all menu items disabled in any given sub menu. You said you are already keeping any array that indicates if a menu item should be enabled or not, use it to check if the message box should come up or the function should be called.
0
 
ZukesAuthor Commented:

Hmmm. Ashoooo, I just ran a few office apps and the VB IDE. You are right... I can see instances where a menu is available and all of its submenus are disabled. If Microsoft does it, it must be ok (!). Why have they built in this dumb rule into their menu control? I guess that means I need another menu control?

0
 
fantasy1001Commented:
In term of MDI, when there is a parent menu which is on the mdi form, if we also add a menu into the child, when the child active, it will use the child menu.

For your case, you can create the menu for each child, for example, when you are creating the menu for the child, then disable directly the menu you don't want. Get it??

Thanks
~ fantasy ~
0
 
ashooooConnect With a Mentor Commented:
Zukes, I guess the menu isnt disabled even though the children are disabled is because so that the user knows that these submenus 'might' be available at a later stage.

You can selectively disable the child menus and keep the parent enabled.
0
 
ZukesAuthor Commented:

Folks, I've messed up.
I've found the problem and it wasn't what I thought.
I can disable all the submenus for a menu and leave the parent enabled.
I didn't investigate the problem enough.
The runtime error occurs when I try to disable a MENU BAR.
I'm sorry to have wasted your time on this.

I will contact the Experts Exchange co-ordinator and see how allocate points
on this. I shall allocate some.
Sorry to have wasted your time and thanks for the comments.

Regards
Zukes (The Unthorough)
0
 
ZukesAuthor Commented:

I've split points based on how much your comments prompted me to solve this.
Thanks & regards,
Zukes
0
 
clanglCommented:
Zukes,
Thanks for the points!!!  DOn't worry about wasting my time.  It is all learning to me.
0
 
ashooooCommented:
Thanks for the points... was glad to help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.