 /*

*!  VERSION 1.0.1  23apr2007

	// SCRIPTS and PROGRAMS for external use
		* PROGRAM gr_over_output
*/

SCRIPT gr_over_PREINIT
BEGIN
	create STRING over1Results
	create STRING over2Results
	create STRING over3Results
END
SCRIPT gr_over_POSTINIT
BEGIN
	program check_over1Results
	program check_over2Results
	program check_over3Results
END

DIALOG gr_over, tabtitle("Categories")
BEGIN
  CHECKBOX ck_over1	_lft	_top	_iwd	_ht4h,	///
	groupbox					///
	label("Group 1")				///
	onclickon(program gr_over_check_group1)		///
	onclickoff(program gr_over_check_group1)
  TEXT     tx_var1	_ilft	_ss	200	.,	///
	label("Grouping variable:")
  VARNAME  vn_var1	@	_ss	130	.,	///
	label("Grouping variable for group 1")
  BUTTON   bu_over1	+150	@	100	.,	///
	label("Properties  ")				///
	onpush(script show_over_dialog_1)		///
	tooltip("Properties for group 1")

  CHECKBOX ck_over2	_lft	_xxls	_iwd	_ht4h,	///
	groupbox					///
	label("Group 2")				///
	onclickon(program gr_over_check_group2)		///
	onclickoff(program gr_over_check_group2)
  TEXT     tx_var2	_ilft	_ss	200	.,	///
	label("Grouping variable:")
  VARNAME  vn_var2	@	_ss	130	.,	///
	label("Grouping variable for group 2")
  BUTTON   bu_over2	+150	@	100	.,	///
	label("Properties  ")				///
	onpush(script show_over_dialog_2)		///
	tooltip("Properties for group 2")

  CHECKBOX ck_over3	_lft	_xxls	_iwd	_ht4h,	///
	groupbox					///
	label("Group 3")				///
	onclickon(program gr_over_check_group3)		///
	onclickoff(program gr_over_check_group3)
  TEXT     tx_var3	_ilft	_ss	200	.,	///
	label("Grouping variable:")
  VARNAME  vn_var3	@	_ss	130	.,	///
	label("Grouping variable for group 3")
  BUTTON   bu_over3	+150	@	100	.,	///
	label("Properties  ")				///
	onpush(script show_over_dialog_3)		///
	tooltip("Properties for group 3")

  TEXTBOX  tb_note	_lft	_xxls	_iwd	_tb1,	///
	label("Note: three category groupings are"	///
	    "allowed only when graphing on a single statistic of a single variable.")
END

PROGRAM gr_over_check_group1
BEGIN
	if gr_over.ck_over1 {
		call gr_over.tx_var1.enable
		call gr_over.vn_var1.enable
		call gr_over.bu_over1.enable
	}
	else {
		call gr_over.tx_var1.disable
		call gr_over.vn_var1.disable
		call gr_over.bu_over1.disable
	}
END

PROGRAM gr_over_check_group2
BEGIN
	if gr_over.ck_over2 {
		call gr_over.tx_var2.enable
		call gr_over.vn_var2.enable
		call gr_over.bu_over2.enable
	}
	else {
		call gr_over.tx_var2.disable
		call gr_over.vn_var2.disable
		call gr_over.bu_over2.disable
	}
END

PROGRAM gr_over_check_group3
BEGIN
	if gr_over.ck_over3 {
		call gr_over.tx_var3.enable
		call gr_over.vn_var3.enable
		call gr_over.bu_over3.enable
	}
	else {
		call gr_over.tx_var3.disable
		call gr_over.vn_var3.disable
		call gr_over.bu_over3.disable
	}
END

SCRIPT show_over_dialog_1
BEGIN
	create CHILD gr_over_options AS over1, allowsubmit
	over1.setExitString over1Results
	over1.setOkAction "program check_over1Results"
	over1.setSubmitAction "script over1Submit"
END
PROGRAM check_over1Results
BEGIN
	if over1Results {
		call gr_over.bu_over1.setlabel "Properties *"
	}
	else {
		call gr_over.bu_over1.setlabel "Properties  "
	}
END
SCRIPT over1Submit
BEGIN
	program check_over1Results
	Submit
END

SCRIPT show_over_dialog_2
BEGIN
	create CHILD gr_over_options AS over2, allowsubmit
	over2.setExitString over2Results
	over2.setOkAction "program check_over2Results"
	over2.setSubmitAction "script over2Submit"
END
PROGRAM check_over2Results
BEGIN
	if over2Results {
		call gr_over.bu_over2.setlabel "Properties *"
	}
	else {
		call gr_over.bu_over2.setlabel "Properties  "
	}
END
SCRIPT over2Submit
BEGIN
	program check_over2Results
	Submit
END

SCRIPT show_over_dialog_3
BEGIN
	create CHILD gr_over_options AS over3, allowsubmit
	over3.setExitString over3Results
	over3.setOkAction "program check_over3Results"
	over3.setSubmitAction "script over3Submit"
END
PROGRAM check_over3Results
BEGIN
	if over3Results {
		call gr_over.bu_over3.setlabel "Properties *"
	}
	else {
		call gr_over.bu_over3.setlabel "Properties  "
	}
END
SCRIPT over3Submit
BEGIN
	program check_over3Results
	Submit
END

PROGRAM gr_over1_options_output
BEGIN
	beginoptions
		put over1Results
	endoptions
END
PROGRAM gr_over2_options_output
BEGIN
	beginoptions
		put over2Results
	endoptions
END
PROGRAM gr_over3_options_output
BEGIN
	beginoptions
		put over3Results
	endoptions
END

PROGRAM gr_over_output
BEGIN
	if gr_over.ck_over1 {
		require gr_over.vn_var1
		put " over("
		put gr_over.vn_var1
		put /program gr_over1_options_output
		put ") "
	}
	if gr_over.ck_over2 {
		require gr_over.vn_var2
		put " over("
		put gr_over.vn_var2
		put /program gr_over2_options_output
		put ") "
	}
	if gr_over.ck_over3 {
		require gr_over.vn_var3
		put " over("
		put gr_over.vn_var3
		put /program gr_over3_options_output
		put ") "
	}
END
