/*
  testanova_new_eqe.dlg

*!  VERSION 1.0.1  26jun2009

  keyword:  eclass

*/

VERSION 11.0

INCLUDE _std_large
DEFINE _dlght 200
INCLUDE header

RESET res1

PROGRAM POSTINIT_PROGRAM
BEGIN
	call create STRING cmd_sub
	call create BOOLEAN use_eqname

	call cmd_sub.setvalue e(cmd)

	if cmd_sub.iseq("manova") {
		call script use_depvar
		call use_eqname.setfalse
	}
	else {
		call script use_eqnames
		call use_eqname.settrue
	}
END

DIALOG main, tabtitle("Main")
BEGIN
  TEXT tx_eqn1		_lft	_top	_cwd1	.,			///
	label("Equation 1: (required)")
  DEFINE holdy @y
  COMBOBOX cb_eqn1_1	@	_ss	_cwd1	.,			///
	dropdown							///
	contents(ereturn eqnames) 					///
	label("Equation 1")
  COMBOBOX cb_eqn1_2	@	@	@	.,			///
	dropdown							///
	contents(ereturn depvar) 					///
	label("Equation 1")
  TEXT tx_eqn2		_lft2	holdy	_cwd1	.,			///
	label("Equation 2: (required)")
  COMBOBOX cb_eqn2_1	@	_ss	_cwd1	.,			///
	dropdown							///
	contents(ereturn eqnames) 					///
	label("Equation 2")
  COMBOBOX cb_eqn2_2	@	@	@	.,			///
	dropdown							///
	contents(ereturn depvar) 					///
	label("Equation 2")
  TEXT tx_eqn3		_lft	_ms	_cwd1	.,			///
	label("Equation 3:")
  DEFINE holdy @y
  COMBOBOX cb_eqn3_1	@	_ss	_cwd1	.,			///
	dropdown							///
	contents(ereturn eqnames) 					///
	label("Equation 3")
  COMBOBOX cb_eqn3_2	@	@	@	.,			///
	dropdown							///
	contents(ereturn depvar) 					///
	label("Equation 3")
  TEXT tx_eqn4		_lft2	holdy	_cwd1	.,			///
	label("Equation 4:")
  COMBOBOX cb_eqn4_1	@	_ss	_cwd1	.,			///
	dropdown							///
	contents(ereturn eqnames) 					///
	label("Equation 4")
  COMBOBOX cb_eqn4_2	@	@	@	.,			///
	dropdown							///
	contents(ereturn depvar) 					///
	label("Equation 4")
  TEXT tx_eqn5		_lft	_ms	_cwd1	.,			///
	label("Equation 5:")
  DEFINE holdy @y
  COMBOBOX cb_eqn5_1	@	_ss	_cwd1	.,			///
	dropdown							///
	contents(ereturn eqnames) 					///
	label("Equation 5")
  COMBOBOX cb_eqn5_2	@	@	@	.,			///
	dropdown							///
	contents(ereturn depvar) 					///
	label("Equation 5")
  TEXT tx_eqn6		_lft2	holdy	_cwd1	.,			///
	label("Equation 6:")
  COMBOBOX cb_eqn6_1	@	_ss	_cwd1	.,			///
	dropdown							///
	contents(ereturn eqnames) 					///
	label("Equation 6")
  COMBOBOX cb_eqn6_2	@	@	@	.,			///
	dropdown							///
	contents(ereturn depvar) 					///
	label("Equation 6")
  TEXT tx_coef		_lft	_ms	_iwd	.,			///
	label("Test these coefficients: (leave blank for all)")
  VARLIST vl_coef	@	_ss	_iwd	.,			///
	label("Test these coefficients")
END

SCRIPT use_depvar
BEGIN
	main.cb_eqn1_1.hide
	main.cb_eqn2_1.hide
	main.cb_eqn3_1.hide
	main.cb_eqn4_1.hide
	main.cb_eqn5_1.hide
	main.cb_eqn6_1.hide

	main.cb_eqn1_2.show
	main.cb_eqn2_2.show
	main.cb_eqn3_2.show
	main.cb_eqn4_2.show
	main.cb_eqn5_2.show
	main.cb_eqn6_2.show
END

SCRIPT use_eqnames
BEGIN
	main.cb_eqn1_1.show
	main.cb_eqn2_1.show
	main.cb_eqn3_1.show
	main.cb_eqn4_1.show
	main.cb_eqn5_1.show
	main.cb_eqn6_1.show

	main.cb_eqn1_2.hide
	main.cb_eqn2_2.hide
	main.cb_eqn3_2.hide
	main.cb_eqn4_2.hide
	main.cb_eqn5_2.hide
	main.cb_eqn6_2.hide
END

PROGRAM command
BEGIN
	if use_eqname {
		require main.cb_eqn1_1
		require main.cb_eqn2_1
		put "([" main.cb_eqn1_1 "=" main.cb_eqn2_1
		if main.cb_eqn3_1 {
			put "=" main.cb_eqn3_1
		}
		if main.cb_eqn4_1 {
			put "=" main.cb_eqn4_1
		}
		if main.cb_eqn5_1 {
			put "=" main.cb_eqn5_1
		}
		if main.cb_eqn6_1 {
			put "=" main.cb_eqn6_1
		}
		put "]"
	}
	else {
		require main.cb_eqn1_2
		require main.cb_eqn2_2
		put "([" main.cb_eqn1_2 "=" main.cb_eqn2_2
		if main.cb_eqn3_2 {
			put "=" main.cb_eqn3_2
		}
		if main.cb_eqn4_2 {
			put "=" main.cb_eqn4_2
		}
		if main.cb_eqn5_2 {
			put "=" main.cb_eqn5_2
		}
		if main.cb_eqn6_2 {
			put "=" main.cb_eqn6_2
		}
		put "]"
	}

	if main.vl_coef {
		put ":" main.vl_coef
	}
	put ")"
END
