On Apr 11, 2009, at 12:49 PM, [email protected] wrote:

Thank you again for your help, which is invaluable.

You are welcome.

I am not sure where
else I could find commands like "scrollLineIntoView"? Very appreciated.

The documented APIs and properties are currently available in the following chapter of the manual:

<https://revolution.screenstepslive.com/spaces/revolution_tools/manuals/datagrid/chapters/991 >

Of course I only added ScrollLineIntoView yesterday so if you looked for it before that you would have been out of luck :-)

I was able to apply much of your example code. And this leads me to the
next question, since you are being so kind with examples.

The code (and data grids in general) are seemingly line oriented, as far
as I can tell.

Internally the data grid stores your data in a multi-dimensional array. The first dimension of the array contains numerical indexes, hence the references to indexes in some of the API calls. The index value for an entry will never change over the life of the data grid unless you delete it. The line number for an entry can change based on sorting, the addition of additional lines, etc. Targeting specific lines is merely a convenience in the API. Under the hood the targeted line number is converted to an index in order to locate the data to modify or delete.

I want to be able to change one cell at a time.  I came up
with some code that works, but frankly it's pretty ugly.  Is there a
command like "modifyCell" ?

SetDataOfLine/SetDataOfIndex can modify single cell values.

If you want to update the value of a single cell in the table then you use SetDataOfLine/SetDataOfIndex and pass in the name of your column as the second parameter. Note that even though you are updating a single cell value the entire line will be redrawn.

Here below is some code, it takes a line out of the data grid, puts it
into an array, deletes the original line in the grid, modifies one element
in the array, then converts the array back to a form suitable for
"addLine", and then puts it back into the data grid in place of the
deleted line. It would be cleaner if this could all be done in place, ie, right in the data grid itself. The data grid has 9 columns so hard coding
every one is clumsy too.

Perhaps you can suggest improvements to this? If not, no problem, I can
make this method work.

I think you will be pleased to know that we can clean this up quite a bit. A couple of things -

1) There is no need to convert data from an array to text. The AddLine command is available if your data is already in tab delimited format but in your code you already have an array (theA). This means you can use AddData rather than AddLine.

2) You can update data associated with a line without deleting it.

Here is what your code might look like based on the two points above.

put the dgdataofline[3] of group "data grid 1" of card "data grid card" into theA
put "foobar" into theA["col 3"]
set the dgDataOfLine of group "data grid 1" of card "data grid card" to theA

Of course you can simplify this even further by doing the following:

dispatch "SetDataOfLine" to group "data grid 1" of card "data grid card" with 3, "col 3", "foobar"

Make sense?

And again, I am very grateful for your patience
with me as a novice.

My pleasure. You will be an experienced pro in no time.

Regards,

--
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com    -    www.screensteps.com
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to