hi,
im having trouble creating a child item of an already existing parent Item of an Outline View.
heres the code
on clicked theObject
if name of theObject is "add" then
set group_name to contents of text field "text1" of window "main"
set ext_name to contents of text field "text2" of window "main"
set outlineView to outline view 1 of scroll view 1 of window 1
tell dataSource
make new data column at end of data columns with properties {name:"Item"}
make new data column at end of data columns with properties {name:"Identity"}
end tell
set item_list to contents of data cell 1 of every data item of dataSource
log item_list
set item_list to item_list as list
if group_name is not in item_list then
set parentItem to make new data item at end of data cell group_name of data item 1 of dataSource
set contents of data cell "Item" of parentItem to group_name
set contents of data cell "Identity" of parentItem to ""
-- create child
set childItem to make new data item at end of data items of parentItem
set contents of data cell "Item" of childItem to group_name
set contents of data cell "Identity" of childItem to ext_name
set data source of outlineView to dataSource
set returns records of data source of outlineView to false
set prefs to content of outlineView
set contents of default entry "mem" of user defaults to prefs
--this is the bit i can't quite get,
else
set theData to data cell "Item" of data item group_name of data source of outlineView
log theData
set childItem to make new data item at end of theData
set contents of data cell "Item" of childItem to group_name
set content of data cell "Identity" of childItem to ext_name
end if
if not (exists default entry "mem" of user defaults) then
make new default entry at end of default entries of user defaults with properties {name:"mem", contents:prefs}
set outlineView to outline view 1 of scroll view 1 of window 1
set returns records of data source of outlineView to false
set prefs to content of outlineView
set contents of default entry "mem" of user defaults to prefs
end if
end if
if name of theObject is "remove" then
set outlineView to outline view 1 of scroll view 1 of window 1
set selectedDataRows to selected data items of outlineView
if (count of selectedDataRows) > 0 then
tell window of theObject
delete (item 1 of selectedDataRows)
end tell
end if
end if
set a to content of outlineView
set contents of default entry "mem" of user defaults to a
end clicked
sorry if its a bit long winded
any advice would be greatly appreciated
many thanks
truth