/*
    xtdpd_lgmmiv_option.dlg
 
*!  VERSION 1.0.1  20apr2009
 
*/

VERSION 11.0

INCLUDE _std_large
DEFINE _dlght 290
INCLUDE header_gr_child

DEFINE c1 20
DEFINE c1wd 70

DEFINE c2 95
DEFINE c2wd 230

DEFINE c3h 355
DEFINE c3hwd 120
DEFINE c3 355


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


DIALOG main, tabtitle("Main")	///
	label("GMM-type instruments for the level equation")
BEGIN
  GROUPBOX gb_instruments	_lft	_top	_iwd	_ht23h,		///
	label("GMM-type instruments for the level equation")

  //Headings
  TEXT     tx_eq		_ilft	_ms	c1wd	.,		///
  	label("Instruments")

  TEXT     tx_level		c2	@	c2wd	.,		///
  	label("Level variables")

  TEXT     tx_lags		c3h	@	c3hwd	.,		///
	label("Override lag")


//Instrument 1
  CHECKBOX ck_1			c1	_ms	c1wd	.,		///
  	label("Inst. 1")						///
  	onclickon(program main_1_on)					///
  	onclickoff(script main_1_off)
  VARLIST  vl_level_1		c2	@	c2wd	.,		///
  	label("Level variables for instrument 1") ts
  CHECKBOX ck_lags_1		c3	@	_ckwd	.,		///
	onclickon(program main_lag1_on)					///
	onclickoff(main.ed_lags_1.disable)
  EDIT     ed_lags_1		_cksep	@	100	.,		///
	label("Lags for instrument 1") option(lag)


//Instrument 2
  CHECKBOX ck_2			c1	_ms	c1wd	.,		///
  	label("Inst. 2")						///
  	onclickon(program main_2_on)					///
  	onclickoff(script main_2_off)
  VARLIST  vl_level_2		c2	@	c2wd	.,		///
  	label("Level variables for instrument 2") ts
  CHECKBOX ck_lags_2		c3	@	_ckwd	.,		///
	onclickon(program main_lag2_on)					///
	onclickoff(main.ed_lags_2.disable)
  EDIT     ed_lags_2		_cksep	@	100	.,		///
	label("Lags for instrument 2") option(lag)


//Instrument 3
  CHECKBOX ck_3			c1	_ms	c1wd	.,		///
  	label("Inst. 3")						///
  	onclickon(program main_3_on)					///
  	onclickoff(script main_3_off)
  VARLIST  vl_level_3		c2	@	c2wd	.,		///
  	label("Level variables for instrument 3") ts
  CHECKBOX ck_lags_3		c3	@	_ckwd	.,		///
	onclickon(program main_lag3_on)					///
	onclickoff(main.ed_lags_3.disable)
  EDIT     ed_lags_3		_cksep	@	100	.,		///
	label("Lags for instrument 3") option(lag)


//Instrument 4
  CHECKBOX ck_4			c1	_ms	c1wd	.,		///
  	label("Inst. 4")						///
  	onclickon(program main_4_on)					///
  	onclickoff(script main_4_off)
  VARLIST  vl_level_4		c2	@	c2wd	.,		///
  	label("Level variables for instrument 4") ts
  CHECKBOX ck_lags_4		c3	@	_ckwd	.,		///
	onclickon(program main_lag4_on)					///
	onclickoff(main.ed_lags_4.disable)
  EDIT     ed_lags_4		_cksep	@	100	.,		///
	label("Lags for instrument 4") option(lag)


//Instrument 5
  CHECKBOX ck_5			c1	_ms	c1wd	.,		///
  	label("Inst. 5")						///
  	onclickon(program main_5_on)					///
  	onclickoff(script main_5_off)
  VARLIST  vl_level_5		c2	@	c2wd	.,		///
  	label("Level variables for instrument 5") ts
  CHECKBOX ck_lags_5		c3	@	_ckwd	.,		///
	onclickon(program main_lag5_on)					///
	onclickoff(main.ed_lags_5.disable)
  EDIT     ed_lags_5		_cksep	@	100	.,		///
	label("Lags for instrument 5") option(lag)


//Instrument 6
  CHECKBOX ck_6			c1	_ms	c1wd	.,		///
  	label("Inst. 6")						///
  	onclickon(program main_6_on)					///
  	onclickoff(script main_6_off)
  VARLIST  vl_level_6		c2	@	c2wd	.,		///
  	label("Level variables for instrument 6") ts
  CHECKBOX ck_lags_6		c3	@	_ckwd	.,		///
	onclickon(program main_lag6_on)					///
	onclickoff(main.ed_lags_6.disable)
  EDIT     ed_lags_6		_cksep	@	100	.,		///
	label("Lags for instrument 6") option(lag)


//Instrument 7
  CHECKBOX ck_7			c1	_ms	c1wd	.,		///
  	label("Inst. 7")						///
  	onclickon(program main_7_on)					///
  	onclickoff(script main_7_off)
  VARLIST  vl_level_7		c2	@	c2wd	.,		///
  	label("Level variables for instrument 7") ts
  CHECKBOX ck_lags_7		c3	@	_ckwd	.,		///
	onclickon(program main_lag7_on)					///
	onclickoff(main.ed_lags_7.disable)
  EDIT     ed_lags_7		_cksep	@	100	.,		///
	label("Lags for instrument 7") option(lag)


//Instrument 8
  CHECKBOX ck_8			c1	_ms	c1wd	.,		///
  	label("Inst. 8")						///
  	onclickon(program main_8_on)					///
  	onclickoff(script main_8_off)
  VARLIST  vl_level_8		c2	@	c2wd	.,		///
  	label("Level variables for instrument 8") ts
  CHECKBOX ck_lags_8		c3	@	_ckwd	.,		///
	onclickon(program main_lag8_on)					///
	onclickoff(main.ed_lags_8.disable)
  EDIT     ed_lags_8		_cksep	@	100	.,		///
	label("Lags for instrument 8") option(lag)
END

// Instrument 1
PROGRAM main_1_on
BEGIN
	call main.vl_level_1.enable
	call main.ck_lags_1.enable
	if main.ck_lags_1 {
		call main.ed_lags_1.enable
	}
END
SCRIPT main_1_off
BEGIN
	main.vl_level_1.disable
	main.ck_lags_1.disable
	main.ed_lags_1.disable
END
PROGRAM main_lag1_on
BEGIN
	if main.ck_lags_1.isenabled() {
		call main.ed_lags_1.enable
	}
END

// Instrument 2
PROGRAM main_2_on
BEGIN
	call main.vl_level_2.enable
	call main.ck_lags_2.enable
	if main.ck_lags_2 {
		call main.ed_lags_2.enable
	}
END
SCRIPT main_2_off
BEGIN
	main.vl_level_2.disable
	main.ck_lags_2.disable
	main.ed_lags_2.disable
END
PROGRAM main_lag2_on
BEGIN
	if main.ck_lags_2.isenabled() {
		call main.ed_lags_2.enable
	}
END

// Instrument 3
PROGRAM main_3_on
BEGIN
	call main.vl_level_3.enable
	call main.ck_lags_3.enable
	if main.ck_lags_3 {
		call main.ed_lags_3.enable
	}
END
SCRIPT main_3_off
BEGIN
	main.vl_level_3.disable
	main.ck_lags_3.disable
	main.ed_lags_3.disable
END
PROGRAM main_lag3_on
BEGIN
	if main.ck_lags_3.isenabled() {
		call main.ed_lags_3.enable
	}
END

// Instrument 4
PROGRAM main_4_on
BEGIN
	call main.vl_level_4.enable
	call main.ck_lags_4.enable
	if main.ck_lags_4 {
		call main.ed_lags_4.enable
	}
END
SCRIPT main_4_off
BEGIN
	main.vl_level_4.disable
	main.ck_lags_4.disable
	main.ed_lags_4.disable
END
PROGRAM main_lag4_on
BEGIN
	if main.ck_lags_4.isenabled() {
		call main.ed_lags_4.enable
	}
END

// Instrument 5
PROGRAM main_5_on
BEGIN
	call main.vl_level_5.enable
	call main.ck_lags_5.enable
	if main.ck_lags_5 {
		call main.ed_lags_5.enable
	}
END
SCRIPT main_5_off
BEGIN
	main.vl_level_5.disable
	main.ck_lags_5.disable
	main.ed_lags_5.disable
END
PROGRAM main_lag5_on
BEGIN
	if main.ck_lags_5.isenabled() {
		call main.ed_lags_5.enable
	}
END

// Instrument 6
PROGRAM main_6_on
BEGIN
	call main.vl_level_6.enable
	call main.ck_lags_6.enable
	if main.ck_lags_6 {
		call main.ed_lags_6.enable
	}
END
SCRIPT main_6_off
BEGIN
	main.vl_level_6.disable
	main.ck_lags_6.disable
	main.ed_lags_6.disable
END
PROGRAM main_lag6_on
BEGIN
	if main.ck_lags_6.isenabled() {
		call main.ed_lags_6.enable
	}
END

// Instrument 7
PROGRAM main_7_on
BEGIN
	call main.vl_level_7.enable
	call main.ck_lags_7.enable
	if main.ck_lags_7 {
		call main.ed_lags_7.enable
	}
END
SCRIPT main_7_off
BEGIN
	main.vl_level_7.disable
	main.ck_lags_7.disable
	main.ed_lags_7.disable
END
PROGRAM main_lag7_on
BEGIN
	if main.ck_lags_7.isenabled() {
		call main.ed_lags_7.enable
	}
END

// Instrument 8
PROGRAM main_8_on
BEGIN
	call main.vl_level_8.enable
	call main.ck_lags_8.enable
	if main.ck_lags_8 {
		call main.ed_lags_8.enable
	}
END
SCRIPT main_8_off
BEGIN
	main.vl_level_8.disable
	main.ck_lags_8.disable
	main.ed_lags_8.disable
END
PROGRAM main_lag8_on
BEGIN
	if main.ck_lags_8.isenabled() {
		call main.ed_lags_8.enable
	}
END

PROGRAM main_1_output
BEGIN
	varlist main.vl_level_1
	beginoptions
		if main.ck_lags_1 {
			require main.ed_lags_1
			optionarg main.ed_lags_1
		}
	endoptions
END

PROGRAM main_2_output
BEGIN
	varlist main.vl_level_2
	beginoptions
		if main.ck_lags_2 {
			require main.ed_lags_2
			optionarg main.ed_lags_2
		}
	endoptions
END

PROGRAM main_3_output
BEGIN
	varlist main.vl_level_3
	beginoptions
		if main.ck_lags_3 {
			require main.ed_lags_3
			optionarg main.ed_lags_3
		}
	endoptions
END

PROGRAM main_4_output
BEGIN
	varlist main.vl_level_4
	beginoptions
		if main.ck_lags_4 {
			require main.ed_lags_4
			optionarg main.ed_lags_4
		}
	endoptions
END

PROGRAM main_5_output
BEGIN
	varlist main.vl_level_5
	beginoptions
		if main.ck_lags_5 {
			require main.ed_lags_5
			optionarg main.ed_lags_5
		}
	endoptions
END

PROGRAM main_6_output
BEGIN
	varlist main.vl_level_6
	beginoptions
		if main.ck_lags_6 {
			require main.ed_lags_6
			optionarg main.ed_lags_6
		}
	endoptions
END

PROGRAM main_7_output
BEGIN
	varlist main.vl_level_7
	beginoptions
		if main.ck_lags_7 {
			require main.ed_lags_7
			optionarg main.ed_lags_7
		}
	endoptions
END

PROGRAM main_8_output
BEGIN
	varlist main.vl_level_8
	beginoptions
		if main.ck_lags_8 {
			require main.ed_lags_8
			optionarg main.ed_lags_8
		}
	endoptions
END

PROGRAM command
BEGIN
	if main.ck_1 {
		put "lgmmiv("
		put /program main_1_output
		put ") "
	}
	if main.ck_2 {
		put "lgmmiv("
		put /program main_2_output
		put ") "
	}
	if main.ck_3 {
		put "lgmmiv("
		put /program main_3_output
		put ") "
	}
	if main.ck_4 {
		put "lgmmiv("
		put /program main_4_output
		put ") "
	}
	if main.ck_5 {
		put "lgmmiv("
		put /program main_5_output
		put ") "
	}
	if main.ck_6 {
		put "lgmmiv("
		put /program main_6_output
		put ") "
	}
	if main.ck_7 {
		put "lgmmiv("
		put /program main_7_output
		put ") "
	}
	if main.ck_8 {
		put "lgmmiv("
		put /program main_8_output
		put ") "
	}
END
