FROM : Keary Suska
DATE : Sat Jun 28 18:44:23 2008
6/28/08 8:54 AM, also sprach <email_removed>:
> To sumarize, the problem is that I am not able to change the menuItem
> state programatically (ie. in myAction) without avoiding the second
> call to setMenuState. However if the call to myAction comes from a
> button set up in IB (instead the menuItem), then everything goes ok.
> In that case myAction is called by the click of the button and if the
> state of the menuItem is updated by myAction then it is correctly
> changed. No second call to setMenuState is received because the
> originating event came from the button. On the contrary if the event
> originates from the menuItem, first myAction is called, and then
> setMenuState is called.
With controls, the bound value is changed *before* the target-action is
called, as you are seeing, but it seems NSMenuItem does the opposite. If the
calls are sequential--i.e. without a call to the run loop--you could use
performSelector:withObject:afterDelay:to make the setMenuState call.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
DATE : Sat Jun 28 18:44:23 2008
6/28/08 8:54 AM, also sprach <email_removed>:
> To sumarize, the problem is that I am not able to change the menuItem
> state programatically (ie. in myAction) without avoiding the second
> call to setMenuState. However if the call to myAction comes from a
> button set up in IB (instead the menuItem), then everything goes ok.
> In that case myAction is called by the click of the button and if the
> state of the menuItem is updated by myAction then it is correctly
> changed. No second call to setMenuState is received because the
> originating event came from the button. On the contrary if the event
> originates from the menuItem, first myAction is called, and then
> setMenuState is called.
With controls, the bound value is changed *before* the target-action is
called, as you are seeing, but it seems NSMenuItem does the opposite. If the
calls are sequential--i.e. without a call to the run loop--you could use
performSelector:withObject:afterDelay:to make the setMenuState call.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
| Related mails | Author | Date |
|---|---|---|
| Joan Lluch (casa) | Jun 28, 00:06 | |
| Keary Suska | Jun 28, 00:23 | |
| Joan Lluch (casa) | Jun 28, 09:41 | |
| Ken Thomases | Jun 28, 09:59 | |
| Joan Lluch (casa) | Jun 28, 16:54 | |
| Keary Suska | Jun 28, 18:44 | |
| Joan Lluch (casa) | Jun 29, 11:23 |






Cocoa mail archive

