Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to disable some of parent top menu links with sub-menus, so that when I click at the root top nothing should happen until I navigate and click to its sub menus for specific action.

For example, In Cocoa, if I have menu File -> Recent -> "...Recent files list...." , I can press "Recent". I want to prevent pressing "Recent". Can I do it?

Thanks!
Posted
Updated 26-Dec-11 5:07am
v2
Comments
Sergey Alexandrovich Kryukov 26-Dec-11 12:12pm    
Why?
--SA

The question and the rationale behind it is hard to understand, but "disable menu item without disabling it" I could understand in only one way: it is formally not disabled, but the event of click on it is not handled, or it is handler, but the handler does nothing on certain condition. If so, it all depends on the code of the handler which should detect this situation and do nothing. Logical, isn't it?

However, the whole idea looks like a sign of a bad UI design. No matter how you implement such behavior, the user would not get a visual feedback on this state and would not see that the click on some item is useless because it is "disabled but not disabled". It is not clear what's wrong with normal disabled state of the item.

—SA
 
Share this answer
 
I probably not explained myself good enough.

Never mind. The solution is call [menuItem SetAction : 0] for the item having Sub Menus.
In this way you will not be able to select this item.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900