Page 1 of 1

DataGrid - dgColumn problems

Posted: Fri May 27, 2011 2:11 pm
by Simon Knight
Hi,
I have created a datagrid and populated it with data. The user is able to edit the data and I wish to implement some form of range checking to stop illegal values being entered. The obvious place to place a call to range checking routine is from somewhere inside the "FieldEditor", so I have created a behavior script and assigned the FieldEditor to the script as described in the Datagrid documentation.

The problem I have encountered is that I need to pass the name of the column being edited along with its new contents to my external range checking routine. Unfortunately I am unable to get any result from the dgColumn property when called inside the FieldEditor or from the Datagrid group script. I have included the script I have been using from the datagrid group below:

Code: Select all

On CloseFieldEditor pFieldEditor
  
   put cr & "From CloseFieldEditor PFieldEditor " & pFieldEditor & cr after fld"debug"
   
   put "Column Name : " & the dgcolumn of me  & cr after fld"debug"  -- does not work
   put "The text " & the text of pFieldEditor & cr after fld"debug"
   put "The column : " & the dgColumn of pFieldEditor & cr after fld"debug" --does not work
  
   put the dgColumn of me into theCol
   put "Column Name : " & theCol & cr after field"debug"  -- does not work
   
   --put the dgindex of me into theindex
   --put the dgDataOfIndex[theindex] of the dgcontrol of me into theDataA
   --put the text of pFieldEditor into theDataA[the dgColumn of me]
   --set the dgDataOfIndex[theindex] of the dgcontrol of me to theDataA
   
end CloseFieldEditor
The last 4 lines are copied from the datagrid documentation and show that Trevor uses the dgColumn property in the example script. i have also tried :

Code: Select all

 get the dgColumn of me 
   Put it into theCol
   put "Column Name : " & theCol & cr after field"debug"  -- does not work

Can anyone help me out?
Thanks
Simon

Re: DataGrid - dgColumn problems

Posted: Fri May 27, 2011 3:08 pm
by Simon Knight
Further searching of the forum revealed a post by dantomlin where the following code is used:

Code: Select all

put the dgColumn of the target into tColumn
   put "Column Name : " & tColumn & cr after field"debug"
This works and it is possible to reset the value entered into the cell by modifying the text

Code: Select all

set the text of pFieldEditor to "Reset to defaults"
This only works from the datagrid group script, I have been unable to access the column from within the FieldEditor proper.

Simon