DataGrid CloseFieldEditor: row and column of edited cell
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
DataGrid CloseFieldEditor: row and column of edited cell
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
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.
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
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
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w