/*

*! VERSION 1.0.0  24may2011

*/

VERSION 12.0

INCLUDE _std_small
DEFINE _dlght 320
INCLUDE header_gr_child

HELP hlp1, view("help rocregplot")
RESET res1

SCRIPT PREINIT
BEGIN
        create STRING main_covvars
        create LIST COVVARS_LIST
END

SCRIPT POSTINIT
BEGIN
	main_covvars.setvalue e(roccov)
	COVVARS_LIST.Arrdropall

	main_covvars.tokenize COVVARS_LIST
	main.cb_atc11.repopulate
	main.cb_atc12.repopulate
	main.cb_atc13.repopulate
	main.cb_atc14.repopulate
END

DEFINE x 70

DIALOG main, label("")
BEGIN
  GROUPBOX gb_label		_lft	_top	_iwd	300,		///
	label("Specification for curve 1")
  TEXT tx_var01			x	_ms	_vnwd	.,		///
	label("Variable 1:")
  TEXT tx_val01			+150	@	_en7wd	.,		///
	label("Value 1:")
  DEFINE enx @x
  COMBOBOX cb_atc11		x	_ss	_vnwd	.,		///
	dropdown							///
	append								///
	contents(COVVARS_LIST)						///
	label("Variable 1")

  DEFINE yvar1 @y
  TEXT tx_eq1			_vnsep	@	_ckwd	.,		///
	center								///
	label("=")
  EDIT en_atc11			enx	@	_en7wd	.,		///
	numonly								///
	label("Value 1")
  TEXT tx_var02			x	_ls	_vnwd	.,		///
	label("Variable 2:")
  TEXT tx_val02			enx	@	@	.,		///
	label("Value 2:")
  COMBOBOX cb_atc12		x	_ss	_vnwd	.,		///
	dropdown							///
	append								///
	contents(COVVARS_LIST)						///
	label("Variable 2")

  DEFINE  yvar2 @y
  TEXT tx_eq2			_vnsep	@	_ckwd	.,		///
	center								///
	label("=")
  EDIT en_atc12			enx	@	_en7wd	.,		///
	numonly								///
	label("Value 2")
  TEXT tx_var03			x	_ls	_vnwd	.,		///
	label("Variable 3:")
  TEXT tx_val03			enx	@	@	.,		///
	label("Value 3:")
  COMBOBOX cb_atc13		x	_ss	_vnwd	.,		///
	dropdown							///
	append								///
	contents(COVVARS_LIST)						///
	label("Variable 3")

  DEFINE  yvar3 @y
  TEXT tx_eq3			_vnsep	@	_ckwd	.,		///
	center								///
	label("=")
  EDIT en_atc13			enx	@	_en7wd	.,		///
	numonly								///
	label("Value 3")
  TEXT tx_var04			x	_ls	_vnwd	.,		///
	label("Variable 4:")
  TEXT tx_val04			enx	@	@	.,		///
	label("Value 4:")
  COMBOBOX cb_atc14		x	_ss	_vnwd	.,		///
	dropdown							///
	append								///
	contents(COVVARS_LIST)						///
	label("Variable 4")

  DEFINE yvar4 @y
  TEXT tx_eq4			_vnsep	@	_ckwd	.,		///
	center								///
	label("=")
  EDIT en_atc14			enx	@	_en7wd	.,		///
	numonly								///
	label("Value 4")

  GROUPBOX gb_note		_ilft	+35	_ibwd	60,		///
	label("Note")
  TEXTBOX tb_1			_indent	_ss	_inwd	_tb2,		///
	label("You may specify up to 4 values of covariates to be evaluated.")
END

PROGRAM prog_curve_wrk
BEGIN
	if main.cb_atc11 | main.en_atc11 {
		require main.en_atc11
		put main.cb_atc11
		require main.cb_atc11
		put "=" main.en_atc11 " "
	}
	if main.cb_atc12 | main.en_atc12 {
		require main.en_atc12
		put  main.cb_atc12
		require main.cb_atc12
		put "=" main.en_atc12 " "
	}
	if main.cb_atc13 | main.en_atc13 {
		require main.en_atc13
		put  main.cb_atc13
		require main.cb_atc13
		put "=" main.en_atc13 " "
	}
	if main.cb_atc14 | main.en_atc14{
		require main.en_atc14
		put   main.cb_atc14
		require main.cb_atc14
		put "=" main.en_atc14 " "
	}
END

PROGRAM command
BEGIN
	if !main.cb_atc11 & !main.cb_atc12 & !main.cb_atc13 & 		///
		!main.cb_atc14 & !main.en_atc11 & !main.en_atc12 &	///
		!main.en_atc13 & !main.en_atc14 {
		require main.cb_atc11
	}
	if main.cb_atc11 | main.cb_atc12 | main.cb_atc13 |		///
		main.cb_atc14 | main.en_atc11 | main.en_atc12 |		///
		main.en_atc13 | main.en_atc14 {
		put /program prog_curve_wrk
	}
END
