I’m stumped. I have several custom menu items in my application that have been working fine for weeks now. I used to have separate menu items for editing a row in each of two different tables. That is, I had an item for editing the selected row in table 1, and an item for editing the selected row in table 2. (I had to do that because of I need double-clickability of my rows, so they’re set to uneditable - the menu items change the underlying data.)
Tonight I decided to combine those two into a single menu item. The code called by the menu item would then check to see which table is active at the moment, and edit the selected row in that table. Here’s what I added:
set theFirstResponder to first responder of window "mainWindow"
if the name of theFirstResponder is "firstTableView" then
[...old code for edit row in first table copied to here...]
end if
if the name of theFirstResponder is "secondTableView" then
[...old code for edit row in second table copied to here...]
end if
I made no other changes to the code. And it works beautifully.
But now I can only select the edit menu item twice. Thereafter, it and all my other custom menu items become disabled.
I have no code that deals with disabling these menu items. Nor for enabling them, for that matter.
This now happens every time the program is launched. No matter what, you get two edits, then the menu items all become dimmed.
Since my code isn’t doing the disabling, and since I didn’t change anything at all other than adding the code above, what could possibly be causing all those menu items to dim out? Again, they never did this before this change, and now it doesn’t matter which table is edited (and therefore which set of copied code is run), it always happens.
I tried going back to a previously saved nib file, making the same changes to it (deleting one of the edit items, changing the title of the other and renaming it). I got the same result.
Any ideas?
-Joe