Now, to answer my own question:
require 'grid'
coclass 'ejzgrid'
coinsert 'jzgrid'
gridpdestroy=: 3 : 0
closedgrid__egrid=: CELLDATA__grid
wd 'pclose'
destroy__grid''
codestroy''
)
egridpshow=: 3 : 0
((,:'CELLEDIT';1);coname'') gridpshow y
)
coclass 'egrid'
create=: 3 : 0
closedgrid=: __
)
drawgrid=: 3 : 0
t=: conew 'ejzgrid'
egrid__t=: coname ''
egridpshow__t y
)
celldata=: 3 : 0
if. closedgrid-:__ do.
CELLDATA__grid__t
else.
closedgrid
end.
)
Following is a sample use case:
g=: ''conew 'egrid'
drawgrid__g i. 3 3
NB. the grid window is shown
NB. and we change the first element into 9
celldata__g''
9 1 2
3 4 5
6 7 8
NB. here we close the grid window
celldata__g''
9 1 2
3 4 5
6 7 8
I might have done something stupid in the script, since I am not very
familiar with locale programming in J. Any suggestions for
improvement?
2008/6/1, June Kim <[EMAIL PROTECTED]>:
> I was aware of grid facility in J, but never have used it. I want to
> learn and use it. The first thing I want to do with grid is getting
> user's input along with showing the contents. Just like a simple
> spreadsheet, as a means for modifying the matrix.
>
> Could anyone give me the definition of the verb that first displays
> the contents of y, and after user modifies it and closes the grid
> window, that returns the new values?
>
> Thanks in advance.
>
> June
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm