I've spent 1 1/2 days on this, and come to the conclusion that there's something wrong with insertObject_atArrangedObjectIndex_(anEntry2, storeEditRow )
The script below proves to me that the array I'm trying to insert is correct, but the insertion throws an error. The script 'hangs' on the insertion code being executed.
on editChosenAlarm_(sender)
theErrorTextField's setStringValue_("")
say "editing"
set enabled of cancelEditButton to true
set enabled of deleteAlarm to false
my sayTheSoundError_("You chosen an Alarm to Edit. Click 'Cancel Edit' if you don't want to Edit it.")
tell theArrayController to set tempRow to (santasAlarmClockTable's selectedRow()) as integer
if tempRow ≠ -1 then
if editAlarmFlag = 2 then
say "store Edit row "& storeEditRow
set enabled of cancelEditButton to false
set anEntry2 to my setTheSavedString()
tell theArrayController to removeObjectAtArrangedObjectIndex_(storeEditRow)
tell theWindow to displayIfNeeded()
say "inserting"
display dialog (theActiveColumn of (text item 1 of anEntry2)= greenCircle)&(theSpeakColumn of (text item 1 of anEntry2)= greenCircle)&(theiTunesColumn of (text item 1 of anEntry2)= greenCircle)&(thePlayListRandomColumn of (text item 1 of anEntry2)= greenCircle)&(theDisplayFlagColumn of (text item 1 of anEntry2)= greenCircle) as text
tell theArrayController to insertObject_atArrangedObjectIndex_(anEntry2, storeEditRow )
tell theWindow to displayIfNeeded()
say "should be inserted"
--tell theArrayController to addObject_(anEntry2)
--my tableSelect_(storeEditRow)
set editAlarmFlag to 0
set theEditButton's title to "Edit Chosen Alarm"
set title of saveNewAlarm to "Save New Alarm"
tell theWindow to displayIfNeeded()
my saveData_(sender)
else
set storeEditRow to tempRow as integer
my loadTheFieldsandButtons()
end if
end if
end editChosenAlarm_