/*
  csi.dlg

*! VERSION 1.2.0  23may2007

*/

VERSION 10.0

INCLUDE _std_medium
INCLUDE _ht260
INCLUDE header
HELP hlp1, view("help csi")
RESET res1

DEFINE     rowhght    31
DEFINE     rowhght2   61
DEFINE     rowskip    +5
DEFINE     rowskip2   +25

DEFINE     col1wd     75
DEFINE     col2       100
DEFINE     col2wd     120
DEFINE     col2i      110
DEFINE     col3       230
DEFINE     col3i      229
DEFINE 	   spwd       100

PROGRAM POSTINIT_PROGRAM
BEGIN
	if __MESSAGE.iseq("-exact-") {
		call main.ck_exact.seton
	}
END

DIALOG main, label("csi - Cohort studies") tabtitle("Main")
BEGIN
  TEXT     tx_exp1	col2i	_top	spwd	_ht5h,		///
	center label("Exposed")
  TEXT     tx_unexp1	col3i	@	spwd	_ht5h,		///
	center label("Unexposed")
  FRAME    fr_exp2	_lft	_ms	_iwd	rowhght,
  FRAME    fr_exp1	col2	@	col2wd	rowhght2,

  TEXT     tx_goto_e	_lft	@	0	_ht0,

  TEXT     tx_cases1	_indent	rowskip	col1wd	., label("Cases")
  SPINNER  sp_a		col2i	@	spwd	.,		///
	label("a") min(0) max(10000000)
  SPINNER  sp_b		col3i	@	spwd	.,		///
	label("b") min(0)  max(10000000)

  FRAME    fr_unexp2	_lft	rowskip2 _iwd	rowhght,

  TEXT     tx_controls	_indent	rowskip	col1wd	.,		///
	label("Noncases")
  SPINNER  sp_c		col2i	@	spwd	.,		///
	label("c") min(0) max(10000000)
  SPINNER  sp_d		col3i	@	spwd	.,		///
	label("d") min(0) max(10000000)

  CHECKBOX ck_or	_lft	_xls	_iwd	.,		///
	option(or) label("Report odds ratio")   		///
	onclickon(script or_on)					///
	onclickoff(script or_off)
  CHECKBOX ck_woolf	@	_ms	@	.,		///
	option(woolf) label("Woolf approximation")
  CHECKBOX ck_tb	@	_ms	@	.,		///
	option(tb) label("Test-based confidence intervals")

  CHECKBOX ck_exact	@	_ms	@	.,		///
	option(exact) label("Fisher's exact p")

  DEFINE _x _lft
  DEFINE _y _ls
  DEFINE _cx _spr
  INCLUDE _sp_level


END

SCRIPT or_on
BEGIN
	  main.ck_woolf.enable
END

SCRIPT or_off
BEGIN
	  main.ck_woolf.disable
END

PROGRAM command
BEGIN
	put "csi "
	put main.sp_a " " main.sp_b " " main.sp_c " " main.sp_d
	beginoptions
		option main.ck_or
		option main.ck_woolf
		option main.ck_tb
		option main.ck_exact
		INCLUDE _level_main_pr
	endoptions
END
