views:

26

answers:

1

I am making a cocoa app where i have a menu - you can see the picture below - but the problem is when i click on any other option e.g; subtract, multiply or division, it don't get selected. What can be the issue?

Note: When i made the menu, i checked the state option of add to ON and rest of them were OFF.

alt text

+3  A: 

Unlike radio buttons, which are cells in an NSMatrix, there's no easy way to group a bunch of menu items together to get radio-button/checkbox-group functionality. You'll just have to handle this yourself in the action method for all of these menu items: Set the state of the chosen menu item (the action's sender) to on, and all of its neighbors to off.

I'd hope that a menu isn't the only way you're providing users to switch the active operator; the user should at least have buttons to use as well, and should be able to use their keypad if they have one. Don't forget to keep the states of the menu items and the buttons synchronized; you probably should hook all the operator menu items and all the operator buttons up to one action, and update all of them in response to any of them.

You can set tags for the buttons and menu items in IB and check the sender's tag in your code in order to tell which operator the user has selected.

Peter Hosey
@Peter Thanks..
itsaboutcode