Page 1 of 1

Spreadsheet-like behavior of dataGrid

Posted: Sat Jan 19, 2013 9:57 pm
by rbrucep
Apologies if this re-posts; first effort appears not to be showing up.

I'm trying to activate the cell BELOW the current one after user enters data
(i.e. user enters '33' and clicks <RETURN>; I'd like the cell immediately below the one with the 33 to become active for editing)

I've tried 'focus on' after retrieving the names of the fields in the dataGrid, but this seems to be disallowed

Is there a dg command or simple trick I should be thinking of?

Thanks!
Bruce

Re: Spreadsheet-like behavior of dataGrid

Posted: Mon Jan 21, 2013 6:47 pm
by dunbarx
Hi.

There might be several ways to do this, but check out the "closeFieldEditor" message in the datagrid docs.

If you put this into the group script:

Code: Select all

on closeFieldEditor
   put the target
end closeFieldEditor
You will see that the field just edited appears in the message box when you change any data and hit return. You can use this to select the field below. You might see:

field "Col 2 0002"

And then you can select field "Col 2 0003"

Craig Newman

Re: Spreadsheet-like behavior of dataGrid

Posted: Fri Jan 25, 2013 4:04 am
by rbrucep
Thanks!
I'll give it a whirl.

Re: Spreadsheet-like behavior of dataGrid

Posted: Fri Jan 25, 2013 6:34 am
by dunbarx
A better way to do this, since scrolling a datagrid may not return the correct line number when using "the target", is to:

Code: Select all

on closeFieldEditor
      put the dghilitedLines of me && word 2 of the dgColumn of the target
end closeFieldEditor
You can now know which row of which column was just edited, and navigate accordingly.

Craig Newman