/*
  byif.idlg -- standard include dialog for by and if options

*!  VERSION 1.1.1  26jun2009

    // SCRIPTS and PROGRAMS for external use
	* PROGRAM if_output
	* PROGRAM by_output

*/

DIALOG sub, label("") tabtitle("by/if")
BEGIN
  CHECKBOX ck_by	_lft	_top	_iwd	_ht4,		///
  	groupbox						///
	label("Repeat command by groups")			///
	onclickon(script byon)					///
	onclickoff(script byoff)
  TEXT     tx_by	_indent _ss	_inwd	.,		///
	label("Variables that define groups:")
  VARLIST  vl_by	@	_ss	@	.,		///
	label("Variables that define groups")
	
  GROUPBOX gb_sub	_lft	_xls	_iwd	_ht4h,		///
	label("Restrict observations")

  TEXT     tx_if	_ilft	_ss	_inwd	.,		///
	label("If: (expression)")
  EXP      ex_if	@	_ss	@	.,		///
	label("Create...")
END

PROGRAM disable_sub
BEGIN
	call script sub_off
END

PROGRAM enable_sub
BEGIN
	call gaction sub.ck_by.enable
	call gaction sub.gb_sub.enable
	call gaction sub.tx_if.enable
        call gaction sub.ex_if.enable
	if sub.ck_by {
		call script byon
	}
END

SCRIPT byon
BEGIN
	sub.vl_by.enable
END

SCRIPT byoff
BEGIN
	sub.vl_by.disable
END

SCRIPT sub_on
BEGIN
	sub.ck_by.enable
	program sub_by_on
	sub.tx_if.enable
	sub.ex_if.enable
END

PROGRAM sub_by_on
BEGIN
	if sub.ck_by {
		call gaction sub.vl_by.enable
	}
END

SCRIPT sub_off
BEGIN
	sub.ck_by.disable
	sub.vl_by.disable
	sub.gb_sub.disable
	sub.tx_if.disable
	sub.ex_if.disable
END

PROGRAM if_output
BEGIN
	INCLUDE _if_pr
END

PROGRAM by_output
BEGIN
	INCLUDE _by_pr
END

/* END:  byif.idlg */




