Page 1 of 1
DatGrid table editable field saving issue (blinking cusor)
Posted: Wed Sep 28, 2016 5:05 pm
by newpie
Hello, not quite sure how to fix this issue.
Issue: When user is done editing field , but leaves cursor and hits "submit" the edited field contents does not flow into the array. (thDataA). Now if they click anywhere else (out of the edited field) then it will flow in the array with the following code:
Code: Select all
put the dgData of group "DataGrid1" into theDataA
put the dgIndexes of group "DataGrid1" into theIndexes
Question: Not quite sure how I can update the dgData of group when the user puts it in that state (blinking cursor). I did try to focus on another control before above code, but that did not work either.
thanks for any help
Re: DatGrid table editable field saving issue (blinking cuso
Posted: Wed Sep 28, 2016 8:30 pm
by dunbarx
Hi.
When you click on a "cell", you can get information about that cell. This is before the phantom field appears. When you enter text in an open "field" several messages are sent to the group: textChanged, the "keyDowns", the "rawKeyDowns", the "keyUps", that sort of thing.
You can work these with something like:
Code: Select all
on rawkeyUp tKey
put tKey && the target --phantom field
end rawkeyUp
on mouseDown
put the name of the target --row and column designator
end mouseDown
This will give you the actual "cell" you clicked on, and then the value of the keyPress.
So is this of any help? I guess you have an external "submit" button somewhere, and that might either help or hinder your thinking. But you can always store the current value of the open "cell" and refresh the group.
Craig Newman
Re: DatGrid table editable field saving issue (blinking cuso
Posted: Thu Sep 29, 2016 2:10 am
by newpie
Hello, Craig thank you for your reply.
Would updating a custom property called "cellEdit" with true and then when they leave change to false. Then check the value when submit button is hit, if true it would warn them to click out of Editing Cell before continuing. Is this possible?
Thanks
Re: DatGrid table editable field saving issue (blinking cuso
Posted: Thu Sep 29, 2016 3:54 am
by dunbarx
Certainly.
You can set (and read) a custom property in any handler, initiated by any message. Your choice. Open the message watcher, suppress IDE messages so you can make sense of the many that will pop up every time you take a breath, and play with the procedures you want to work with. Find a message you like and trap it in the group script.
As for getting out of (defocusing) edit mode in the DG, here is an old trick, likely now supplanted by more modern and pertinent methods:
Code: Select all
on mouseUp
click at "-1,-1"
end mouseUp
Craig
Re: DatGrid table editable field saving issue (blinking cuso
Posted: Fri Sep 30, 2016 1:59 pm
by newpie
Thank you for the tips Craig I will try them out.
Re: DatGrid table editable field saving issue (blinking cuso
Posted: Tue Oct 04, 2016 3:21 pm
by MaxV
newpie wrote:Hello, not quite sure how to fix this issue.
Issue: When user is done editing field , but leaves cursor and hits "submit" the edited field contents does not flow into the array. (thDataA). Now if they click anywhere else (out of the edited field) then it will flow in the array with the following code:
Code: Select all
put the dgData of group "DataGrid1" into theDataA
put the dgIndexes of group "DataGrid1" into theIndexes
Question: Not quite sure how I can update the dgData of group when the user puts it in that state (blinking cursor). I did try to focus on another control before above code, but that did not work either.
thanks for any help
Why did you use that code? If datagrid has
Code: Select all
set the dgProp["allow editing"] of group "Data Grid" to true
you don't need any code.