I am posting for two reasons - the first is to request expert overview to spot anything I have missed or most likely point out a better method way of implementing the functionality and the second is to have a small example available as a starting point for others to use.
I use a standard table type datagrid and have added the following code to the group script:
Code: Select all
# Note this code is close coupled with the column name which is a bit of a kludge
# See AddNewRow below
on mouseDoubleup
# Identifies if the user wishes to add a new row or to delete an existing one.
if the dgHeaderControl of the target is empty AND \
the dgHeader of the target is empty AND \
the dgDataControl of the target is empty then
-- user clicked in a non header or data area
AddNewRow
end if
if the dgDataControl of the target is not empty \
AND the controlkey is down then
-- delete the row
put the dgHilitedIndex of the target into tIndex
DeleteIndex tIndex
end if
end mouseDoubleup
On AddNewRow
# NOTE : Ensure the column name("path" in this example) matches a column in your datagrid
put "Path" into tColumn
put the dgNumberOfLines of the target + 1 into tLineNo
# Edit next line to display default text or "" as required
put "Test" && tLineNo into theRowData
AddLine theRowData, tColumn, tLineNo
dispatch "EditCell" to me with tColumn, tLineNo
end AddNewRow