NSToolbarItem enabling and disabling problem

Discussion in 'Mac Programming' started by BadWolf13, Mar 20, 2010.

  1. BadWolf13 macrumors 6502

    Joined:
    Dec 17, 2009
    #1
    Ok, I'm totally lost on this one. This program is basically a tableView showing a list of items from an array. The window has a toolbar, with a few buttons that I've created in Interface Builder. One of these buttons is a delete button that is using a binding on it's Enabled status to ArrayController.selection.canDelete. canDelete is a method of the object that the array is using, stating simply whether or not you can delete it, with a simple boolean value.

    This should be simple. After all, when I used a Delete button in the window, configured exactly the same way, it worked. The button was disabled if you selected an item in the list that has a NO value for canDelete. However, when I use an NSToolbarItem instead of an NSButton, it doesn't work. Oddly, what happens is that when you select an item that can't be delete, the button sort of "blinks" into a disabled(greyed out) state, then goes back to being enabled.

    I'm stumped on this, so any advise would be helpful.
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    In IB select the toolbar item and uncheck "Autovalidates" in the Inspector window.
     

Share This Page