---Sherlock, Ric wrote: > ---Leigh J. Halliwell wrote: > > Thank you for the help with the Grid class. However, I'm > > still stumped. > > Can someone write up some J code that allows a user to input > > data via a grid > > into J? For example, set mat equal to the values that > > someone puts into a > > 3x3 grid. Thanks.
I did some more work on the jegrid extension (see below). Basically I've "added" another option (CELLDNAME) to those already available for grid (jwiki/Grid/Options). CELLDNAME lets you specify the name of a noun to assign the grid contents to when it is closed. It defaults to CELLDATA_ED if not specified. To try it out, copy it to a script, load it (Ctrl+w), then: (,:'CELLDNAME';'mat') editgrid 3 3$0 NB. 3x3 grid of zeros will appear NB. Edit as desired NB. Close grid mat 45 0 0 0 4 0 233 0 423 Also try: editgrid i. 3 4 5 NB. When you close grid, contents assigned to default CELLDATA_ED NB.============start jegrid.ijs================================ script_z_ '~system/classes/grid/jzgrid.ijs' coclass 'jegrid' coinsert 'jzgrid' gridpdestroy=: 3 : 0 if. 0~:4!:0 <'CELLDNAME' do. CELLDNAME=. 'CELLDATA_ED' end. (CELLDNAME,'__locD')=. CELLDATA__grid wd 'pclose' destroy__grid'' codestroy'' ) egridp=: 4 : 0 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.============end jegrid.ijs================================ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
