/*
  describe.dlg

*! VERSION 1.1.3  28sep2010

*/

VERSION 11.0

INCLUDE _std_medium
DEFINE _dlght 300
INCLUDE header
HELP hlp1, view("help describe")
RESET res1

DEFINE exin    +70
DEFINE exina   +80
DEFINE exwd     50
DEFINE exwda   195


DIALOG main, label("describe - Describe data in memory") tabtitle("Main")
BEGIN
  TEXT     tx_var        _lft     _top     _iwd        .,	/*
		*/ label("Variables: (leave empty for all variables)")
  VARLIST  vl_var           @      _ss        @        .,	/*
		*/ label("Variables")

  TEXT     tx_examples      @      _ms        @        .,	/*
		*/ label("Examples:")
  TEXT     tx_examp1     exin        @     exwd        ., right	/*
		*/ label("yr*")
  DEFINE   holdx @x
  TEXT     tx_examp1a   exina        @    exwda        .,	/*
		*/ label(`"all variables starting with "yr""')
  TEXT     tx_examp2    holdx      _vss    exwd        ., right	/*
		*/ label("xyz-abc")
  TEXT     tx_examp2a   exina        @    exwda        .,	/*
		*/ label("all variables between xyz and abc")

  GROUPBOX gb_opts       _lft      _ls     _iwd    _ht15,	/*
		*/ label("Options")
  CHECKBOX ck_simple  _indent      _ms    _inwd        .,	/*
  		*/ option(simple)				/*
		*/ onclickon(program check_simple)		/*
		*/ onclickoff(program check_simple)		/*
		*/ label("Display only variable names")
  CHECKBOX ck_short         @      _ms        @        .,	/*
		*/ option(short)				/*
		*/ label("Display only general information")	/*
		*/ onclickon(program check_short)		/*
		*/ onclickoff(program check_short)
  CHECKBOX ck_fullnames     @      _ms        @        .,	/*
		*/ option(fullnames)				/*
		*/ label("Do not abbreviate variable names")	/*
		*/ onclickon(program check_fullnames)		/*
		*/ onclickoff(program check_fullnames)

  CHECKBOX ck_numbers       @      _ms        @        .,	/*
		*/ option(numbers)				/*
		*/ label("Display variable number along with name")/*
		*/ onclickon(program check_numbers)		/*
		*/ onclickoff(program check_numbers)
  CHECKBOX ck_replace      @      _ms        @        .,	/*
		*/ option(replace)				/*
		*/ label("Replace data in memory with describe report")/*
		*/ onclickon(program check_replace_on)		/*
		*/ onclickoff(program check_replace_off)
  CHECKBOX ck_clear      @      _ms        @        .,	/*
		*/ option(clear)				/*
		*/ label("Clear dataset from memory")
END

PROGRAM check_simple
BEGIN
	if main.ck_simple {
		call main.ck_short.disable
		call main.ck_fullnames.disable
		call main.ck_numbers.disable
		call main.ck_replace.disable
		call main.ck_clear.disable
	}
	else {
		call main.ck_short.enable
		call main.ck_replace.enable
		call main.ck_clear.enable
		if ! main.ck_short {
			if ! main.ck_numbers {
				call main.ck_fullnames.enable
			}
			if ! main.ck_fullnames {
				call main.ck_numbers.enable
			}
		}
	}
END

PROGRAM check_short
BEGIN
	if main.ck_short.isenabled() {
		if main.ck_short {
			call main.ck_fullnames.disable
			call main.ck_numbers.disable
			call main.ck_simple.disable
			call main.ck_replace.disable
			call main.ck_clear.disable
		}
		else {
			call main.ck_simple.enable
			call main.ck_replace.enable
			call main.ck_clear.enable
			if ! main.ck_numbers {
				call main.ck_fullnames.enable
			}
			if ! main.ck_fullnames {
				call main.ck_numbers.enable
			}
		}
	}
END

PROGRAM check_fullnames
BEGIN
	if main.ck_fullnames.isenabled() {
		if main.ck_fullnames {
			call main.ck_simple.disable
			call main.ck_short.disable
			call main.ck_replace.disable
			call main.ck_clear.disable
			call main.ck_numbers.disable
		}
		else {
			call main.ck_simple.enable
			call main.ck_short.enable
			call main.ck_replace.enable
			call main.ck_clear.enable
			call main.ck_numbers.enable
		}
	}
END

PROGRAM check_numbers
BEGIN
	if main.ck_numbers.isenabled() {
		if main.ck_numbers {
			call main.ck_simple.disable
			call main.ck_short.disable
			call main.ck_replace.disable
			call main.ck_clear.disable
			call main.ck_fullnames.disable
		}
		else {
			call main.ck_simple.enable
			call main.ck_short.enable
			call main.ck_replace.enable
			call main.ck_clear.enable
			call main.ck_fullnames.enable
		}
	}
END

PROGRAM check_replace_on
BEGIN
	call main.ck_clear.enable
	call main.ck_simple.disable
	call main.ck_short.disable
	call main.ck_fullnames.disable
	call main.ck_numbers.disable
END

PROGRAM check_replace_off
BEGIN
	call main.ck_clear.disable
	call main.ck_simple.enable
	call main.ck_short.enable
	call main.ck_fullnames.enable
	call main.ck_numbers.enable
END

PROGRAM command
BEGIN
	put "describe "
	varlist [main.vl_var]
	beginoptions
		option main.ck_simple
		option main.ck_short
		option main.ck_fullnames
		option main.ck_numbers
		option main.ck_replace
		option main.ck_clear
	endoptions
END
