DataGrid: cell value, column name?

Trevor DeVore lists at mangomultimedia.com
Thu Jul 30 10:21:37 EDT 2009


On Jul 30, 2009, at 9:07 AM, viktoras d. wrote:

> now replacing my table object with Trevor's excellent DataGrid in  
> one project, but somehow can not figure out how do a few elementary  
> things from within script:
> 1) get the value of the current cell of a table

I just made a small tweak to one of the lessons that adds info on  
targeting columns:

How Do I Get Data Associated With a Row or Column?: <http://revolution.screenstepslive.com/spaces/revolution/manuals/datagrid/lessons/3641-How-Do-I-Get-Data-Associated-With-a-Row- 
 >

> 2) get the title of the current column of a table

I assume the current column is the one being edited. In a column  
behavior you can access the dgColumn property to get the name of the  
column. This following lesson has an example.

How Can I Store An Option Menu Value When The User Makes a Selection?:  
<http://revolution.screenstepslive.com/spaces/revolution/manuals/datagrid/lessons/3836 
 >

And I added an entry for dgColumn to the template custom props lesson.

Template Custom Properties: <http://revolution.screenstepslive.com/spaces/revolution/manuals/datagrid/lessons/3462-Template-Custom-Properties 
 >

There is also the dgColumnLabel[COLUMN_NAME] custom property that  
returns the label. It is discussed here:

Data Grid Properties: <http://revolution.screenstepslive.com/spaces/revolution/manuals/datagrid/lessons/3460-Data-Grid-Properties 
 >

> 3) get the current record number of a table

The record number will be the line number.

How Do I Determine The Selected Line?: <http://revolution.screenstepslive.com/spaces/revolution/manuals/datagrid/lessons/3483-How-Do-I-Determine-The-Selected-Line- 
 >

> 4) get the value of a cell of a table by column title and record row  
> number


The first lesson I pointed you shows how to use dgDataOfIndex/Line and  
GetDataOfIndex/Line. dgDataOfIndex gives you the whole row so your  
column will be included. GetDataOfIndex just returns a particular  
column. Both allow targeting of a specific line.

Regards,

-- 
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com    -    www.screensteps.com



More information about the use-livecode mailing list