Supposing there could be a multiple of grid instances at the same
time, I made the modified celldata stored as a field instance of an
object, so that I could keep them all separate. Moreover, I thought
someone might want to access the value of the modified celldata while
the grid window is still open.

Anyway, thanks for the suggestion.

June


2008/6/3 Sherlock, Ric <[EMAIL PROTECTED]>:
> ---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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to