I often use menuitems as buttons (without adding any sub-item), I just write the code on the main menuitem and that’s it.
Someone here on this forum told me it’s seriously bad coding practice (on an old topic about other things)
I’d like to understand WHY, are there any technical problems with this “style” ? I
Its bad coding behavior because it is unexpected functionality for the users who expect a click on a menu to show a drop down. If you want to have buttons at the top of a window you should instead use a toolbar. Doing something like this may even get your app rejected from the mac app store since it doesn’t follow the human interface guidelines.
[quote=146158:@Horacio Vilches]I often use menuitems as buttons (without adding any sub-item), I just write the code on the main menuitem and that’s it.
Someone here on this forum told me it’s seriously bad coding practice (on an old topic about other things)
I’d like to understand WHY, are there any technical problems with this “style” ?[/quote]
What you do works only on Windows, and am not sure it even should. I clearly remember trying to make your design work on Mac and it simply does not. It is impossible to trigger an event simply by clicking the menu bar item (which in terms of interface is not the same as a menu option). That is enough of a technical problem, is it not ?
If you do not want to use a toolbar (I would recommend you do, though) what is the issue about placing buttons on the top of your app window ? It would work just the same and it would be a lot easier for your users. Just keep File/Exit/Quit, and Edit. On Windows, remove the menu from your app if you want.