NB. provides jfreport form

coclass 'jfreport'
require 'jfgrid'
require' convert strings'

NB. =========================================================
REPORT=: 0 : 0
pc report;pn "Watch";
xywh 0 0 147 182;cc grid isigraph ws_border ws_clipchildren rightmove bottommove;
xywh 0 183 147 11;cc scrollbar scrollbar topmove rightmove bottommove;
xywh 147 0 11 182;cc scrollbarv scrollbarv leftmove rightmove bottommove;
pas 0 0;pcenter;
rem form end;
)

NB. =========================================================
create=: 3 : 0
n=. y.,('_'~:{:y.)#'_base_'
if. 0~:4!:0 <n do. wdinfo 'Invalid name: ',y. return. end.
wd REPORT
wdfit''
formhwnd=: wd'qhwndp'
wd'pn *Financial Report - ',y.
grid=: ''conew'jfgrid'
dataname__grid=: n
init__grid ''
wd'setfocus grid'
wd 'pshow;'
)

NB. =========================================================
destroy=: 3 : 0
wd'pclose'
destroy__grid''
codestroy''
)

NB. =========================================================
report_close=: destroy

NB. =========================================================
formselect=: 3 : 'wd''psel '',formhwnd'

report_grid_size=: 3 : 'size__grid 0'
report_grid_mbldown=: 3 : 'mbldown__grid sysdata'
report_grid_mmove=: 3 : 'mmove__grid sysdata'
report_grid_mblup=: 3 : 'mblup__grid sysdata'
report_grid_mbldbl=: 3 : 'mbldbl__grid sysdata'
report_grid_char=: 3 : 'char__grid sysdata;sysmodifiers'
report_grid_copy=: 3 : 'copy__grid 0'
report_grid_paste=: 3 : 'paste__grid 0'

NB. =========================================================
report_scrollbar_button=: 3 : 0
scrollbar__grid scrollbar
wd'setfocus grid'
)

NB. =========================================================
report_scrollbarv_button=: 3 : 0
scrollbarv__grid scrollbarv
wd'setfocus grid'
)

NB. =========================================================
report_f1_fkey=: 3 : 0
wd'mb "Grid Help" *',actiondoc__grid,CRLF,CRLF,'ctrl+m - highlight expression'
)

NB. =========================================================
report_fctrl_fkey=: 3 : 0
f=. wd'mbfont ',font__grid
if.''-:f do. return. end.
formselect__grid''
setfont0__grid f
glpaintx__grid''
wd'setfocus grid'
)
