Page 1 of 1

DataGrid CloseFieldEditor: row and column of edited cell

Posted: Sun Jan 22, 2017 5:15 am
by ElZitouni
Hello: the CloseFIeldEditor message is sent to a datagrid script when the user changed the contents of a table cell. How can I determine the row and column of the cell that has been changed when that message is sent? Thanks, Olli.

Re: DataGrid CloseFieldEditor: row and column of edited cell

Posted: Sun Jan 22, 2017 5:31 pm
by ElZitouni
Hello: for those pondering at some point the same question, this here is a possible solution, at which I arrived after searching the forum and the datagrid API ... could have done that before posting the question, couldn't I?

This code resides in the group script of my datagrid. First, the preOpenFieldEditor message is caught and the cLastClickedCell of the datagrid set to the target of the mouse double click that triggered the opening of a field editor. this property is then used to access the index and key of the cell that changed, ie., upon receipt of the CloseFieldEditor message. With this information at hand, one knows precisely what entry was modified.

Code: Select all

on preOpenFieldEditor pFieldEditor
     set the cLastClickedCell of me to the long name of the target
end preOpenFieldEditor


on CloseFieldEditor pFieldEditor
     local tIndex, tKey
     
     put the dgIndex of the cLastClickedCell of me into tIndex
     put the dgColumn of the cLastClickedCell of me into tKey
end CloseFieldEditor

Re: DataGrid CloseFieldEditor: row and column of edited cell

Posted: Thu Feb 09, 2017 12:57 pm
by MaxV
In order to get row, column and text typed you may use just:

Code: Select all

on CloseFieldEditor pFieldEditor
   put the dgIndex of the target into theRow
   put the dgColumn of the target into theColumnBeingEdited
   put the text of pFieldEditor into theNewText    
end CloseFieldEditor