I have a table, and a Button. When the User clicks the Button, the selected line of the table is deleted.
Works, as long, as the item in the Table is not just beeing edited. Because in this case, a wrong item of the table is deleted
The same thing happens in Apple´s example “Table”, so I don´t believe its the fault of my code. Try the “With Data Source” window of the example, enter some lines, then doubleclick on (not the last) line to edit the entry. While editing klick the “Remove Button”
the code behind the “Remove” Button in Apple´s example is
set tableView to table view "contacts" of scroll view "contacts" of window of theObject
set selectedDataRows to selected data rows of tableView
if (count of selectedDataRows) > 0 then
tell window of theObject
-- Remove the contact form the data source
delete (item 1 of selectedDataRows)
-- Clear out the contact information
my clearContactInfo(window of theObject)
end tell
end if
It seems, that on trying to delete item n, instead item n+1 is deleted (only if just editing). Even if I could find a workaround, it had to be a workaround, that doesnt break things, if this bug is corrected in a future release of Mac OS.
Any ideas, anybody?