---June Kim wrote:
> I might have done something stupid in the script, since I am not very
> familiar with locale programming in J. Any suggestions for
> improvement?

I am a bit of a locale newbie too but I think the script jegrid.ijs script 
below is a bit cleaner.
It still doesn't actually return the changed values, but instead puts them in 
the noun CELLDATA_ED in the locale that the editgrid verb was called from.

Does anyone have any suggestions as to how we can get editgrid to return the 
edited values?

   load '~temp/jegrid.ijs'
   editgrid i. 3 3
NB. Grid opens. Change first element to 99
NB. Close the grid
   CELLDATA_ED
99 1 2
 3 4 5
 6 7 8

('AXISNAMES';<;:'first second third fourth') editgrid i. 3 4 5 2
NB. Multidimensional grid with labelled axes opens. Change as desired.
NB. Close the grid
   $CELLDATA_ED
3 4 5 2


NB.==================jegrid.ijs=====================
script_z_ '~system/classes/grid/jzgrid.ijs'

coclass 'jegrid'
coinsert 'jzgrid'

gridpdestroy=: 3 : 0
  CELLDATA_ED__locD=. CELLDATA__grid
  wd 'pclose'
  destroy__grid''
  codestroy''
)

egridp=: 3 : 0
  '' egridp y
:
  a=. conew 'jegrid'
  x gridpshow__a y
)

editgrid_z_=: 3 : 0
  (0 0$0) editgrid y
:
  opts=. x,,:'CELLEDIT';1
  (opts;coname'') egridp_jegrid_ y
)
NB.========================================

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to