> From: Donald Pittenger
> 
> Anyhow, for now assume the following:
> 
> Data are selected, read into the system and formatted into a matrix
> called DATAMAT (global variable), all in the "base" locale.
> 
> A button on a form is clicked, evoking a handler that might be called
> MainForm_continue_button.  That handler ideally should contain code
> that calls , say, NewForm=: 0 : 0 that creates a form with all the
> gadgets including TWO isigraphs that I'll call grid0 and grid1.
> Let's stipulate that the data in DATAMAT are to appear in grid0.

I've attached some demo code below that may help.

> Actual code I've developed is now too extensive to include in an
> email, so I'm hoping the description above will be good enough as a
> basis for any help.

It is often good to break down your problems to a simple demo when posting - 
means less work for those trying to help you and I find that it often helps me 
understand and solve the problem myself.

Regards,
Ric

NB. ==== Form & Grid Example ==========
require 'grid pack'
coinsert 'jgl2'
DATAMAT=: i.4 5

MAIN=: 0 : 0
pc main;
xywh 136 8 44 12;cc continue button;cn "Continue";
xywh 136 23 44 12;cc cancel button;cn "Cancel";
pas 6 6;pcenter;
rem form end;
)

main_run=: 3 : 0
  wd MAIN
  NB. initialize form here
  wd 'pshow;'
)

main_close=: 3 : 0
  wd'pclose'
)

main_cancel_button=: main_close

main_continue_button=: 3 : 0
  newform_run''
)

NEWFORM=: 0 : 0
pc newform owner;
xywh 141 7 44 18;cc cancel button;cn "Cancel";
xywh 3 4 106 45;cc grid0 isigraph;
xywh 4 57 104 47;cc grid1 isigraph;
pas 6 6;pcenter;
rem form end;
)

newform_run=: 3 : 0
  wd NEWFORM
  NB. initialize form here
  grid0=: conew 'jzgrid'
  update_grid0 DATAMAT
  grid1=: conew 'jzgrid'
  update_grid1 2*DATAMAT
  wd 'pshow;'
)

newform_close=: 3 : 0
  wd'pclose'
  destroy__grid0''
)

newform_cancel_button=: newform_close

update_grid0=: 3 : 0
  CELLDATA=. <"0 y
  GRIDID=. GRIDLOC=. 'grid0'
  show__grid0 pack ;:'CELLDATA GRIDID GRIDLOC'
)

update_grid1=: 3 : 0
  CELLDATA=. <"0 y
  GRIDID=. GRIDLOC=. 'grid1'
  show__grid1 pack ;:'CELLDATA GRIDID GRIDLOC'
)

main_run''
NB. =====================================================


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

Reply via email to