Hi,
I have a bug that I just can’t de.
this little bit of code
on tableDoubleClicked()
if aTableView's selectedRow as integer is not equal to -1 then
tell keywordField to selectText_(me)
my setDoubleClickedSelectedRow_(aTableView's selectedRow as integer)
set thisKeyword to theDataSource's objectAtIndex_(doubleClickedSelectedRow as integer)
my setTheKeyword_(thisKeyword's valueForKey_("theKeyword"))
end if
end tableDoubleClicked
works fine, unless I run
on addData_(sender)
tell keywordField to selectText_(me)
set newData to {theKeyword:theKeyword}
theDataSource's addObject_(newData)
aTableView's reloadData()
my clearFields()
my writeToFile()
end addData_
in which case it won’t work on the added row until I run it on an existing row.
btw addData’s two calls are to
on writeToFile()
set FILE_PATH to ((current application's class "NSBundle"'s mainBundle()'s resourcePath()) as string) & "/keywordList.plist"
if not theDataSource's writeToFile_atomically_(FILE_PATH, true) then
set messageText to "There was an error writing to file"
display dialog messageText buttons {"Ok"} default button 1
end if
end writeToFile
on clearFields()
keywordField's setStringValue_("")
end clearFields
When I log tableDoubleClicked when it’s working and when it’s not everything is identical—just the text doesn’t appear in the keywordField.
There’s a binding on theKeyword
thanks