I'm new to both the forums here as well as LiveCode. I've been playing with a DataGrid, successfully populating it from a SQLite database. I have a form with a datagrid on it (currently just named "DataGrid 1") and some buttons ("Add Record", "Delete Record", and "Save Record") on it that are on the form, but not inside of the datagrid. I've been playing with the "Add Record" button, and I've been able to add a new row to the datagrid, and scroll it down to the new row. What I'm stuck on (and have been researching a lot today), is getting the focus set to the first field in the new row, so that the user can begin typing in the new data for that row. Here's the code I have currently:
Code: Select all
on mouseUp pMouseButton
put NULL into theRowData
put NULL into theColumnData
put the dgNumberOfLines of group "DataGrid 1" + 1 into theLineNo
dispatch "AddLine" to group "DataGrid 1" with theRowData, theColumnData, theLineNo
dispatch "ScrollLineIntoView" to group "DataGrid 1" with theLineNo
// need a dispatch command here to EditFieldText of the "FullName" field in the datagrid or some other code that does this
end mouseUp