If what you want is a nice, standalone piece of code you can extract to
duplicate the functionality of, say, the first grid demo (the one with
cities in European countries), it's not simple to do this.  However, it's
not exceedingly difficult either.  In addition to looking at the wiki as Ric
suggests, you can start the demo in a J session, then move into the demo
namespace to look at the items there.

For instance, in your J session after you've started the demo and brought up
the cities grid example, you can do this to move to the locale, look at the
variable names, and look at the "definition" for that example (however, you
still need to figure out which code to copy to set up the form and all):

   coclass 'jgriddemo'
   names 0
ALPHAS       CCOLORS      CCOLSIZE     CCONTROLS    CCOUNTRIES
CCUBE        CDEVTRIANGLE CDIR         CELLDATA     CELLEDIT
CELLFMT      CFINANCIAL   CGRID        CHIER        CLASS
CMLINE       COLMINWIDTH  COUNTRIES    CTABLE       CVCOUNTRIES
DCOLORS      DCOLSIZE     DCONTROLS    DCOUNTRIES   DCUBE
DDEVTRIANGLE DDIR         DEVOPTS      DFINANCIAL   DGRID
DGRIDCE      DHIER        DMLINE       DTABLE       DVCOUNTRIES
GNOTES       GRIDALL      GRIDDEMO     GRIDDEMOCE   GRIDDEMOSEL
GRIDEDIT     GRIDEDITHELP GRIDEXAMS    GRIDNAMES    GRIDPID
HDRCOL       HDRCOLALIGN  HDRCOLMERGE  HDRROW       HDRROWALIGN
HDRROWMERGE  MAINDIR      MONTHS       NCOLORS      NCOLSIZE
NCONTROLS    NCOUNTRIES   NCUBE        NDEVTRIANGLE NDIR
NFINANCIAL   NGRID        NHIER        NMLINE       NTABLE
NVCOUNTRIES  PForm        grid

   DGRID
j=. 'Lyon';'Nice';'Paris';'Berlin';'Bonn';'Dresden'
city=. j,'Hamburg';'Munich';'Milan';'Rome';'Total'
qtr=. ('1st';'2nd';'3rd';'4th') ,each <' Quarter'
mth=. 'JanFebMarAprMayJunJulAugSepOctNovDec'

HDRCOL=: 9 4 # 'Actual';'Forecast'
HDRCOL=: HDRCOL,:(3 # qtr),<'Year'
HDRCOL=: HDRCOL, (_3 <\ mth),<'Total'
HDRCOLALIGN=: 1
HDRCOLMERGE=: 1 1

HDRROW=: (3 5 2 # 'France';'Germany';'Italy'),<''
HDRROW=: HDRROW ,. city
HDRROWALIGN=: 1
HDRROWMERGE=: 1

COLMINWIDTH=: 50

grid_gridhandler=: 3 : 0
if. y -: 'change' do.
  changex__grid''
  CELLDATA__grid=: sumdata 10 12 {. CELLDATA__grid
  0 [ show__grid''
end.
()

CELLDATA=: sumdata ?. 10 12$1500
CELLFMT=: 'c'
CELLEDIT=: ((10 12$1),0),.0

NB. Look at the numbers in the active grid:
   $CELLDATA__grid
11 13
   3 3{.CELLDATA__grid
1146  755 1079
1213 1318  151
 864  671 1213

NB. Change the numbers:
   3 3{.CELLDATA__grid=: (99.9) ({2$<i.2)}CELLDATA__grid
99.9 99.9 1079
99.9 99.9  151
 864  671 1213

NB. Now do something in the grid like "Zoom Out" or "Flip" to force
re-display to show the data changes.
NB. I haven't figured out what you have to do programmatically to
re-display.




On Wed, Sep 17, 2008 at 6:44 PM, Sherlock, Ric <[EMAIL PROTECTED]>wrote:

> ---Alfonso Salazar wrote:
> > I am studying the definition of the first grid in Studio\
> > Demos.. and I would like to know like one  could become a
> > verb and use it in any .ijs
>
> I'm not very clear what you're exactly asking.
>
> I think you want to know how to integrate the demo definition into a
> working script?
>
> If so, studying the examples on the following page will help show how to
> initialise a grid and pass parameters to it:
>
> http://www.jsoftware.com/jwiki/Grid/Examples
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to