/*
  gr_ed_refine.dlg

*!  VERSION 1.0.1  24aug2007

*/

VERSION 10.0
MODAL

INCLUDE _std_vsmall
DEFINE _dlght 60
INCLUDE header_gr_ed

DEFINE _clwd	15
DEFINE _wd	120
DEFINE _sep	+125
DEFINE _cbwd	130
DEFINE _cbsep	+135

SCRIPT PREINIT
BEGIN
	create STRING G
	create STRING parent_name
	create STRING tmajor
	create STRING this_name
	create STRING axis
	
	this_name.setvalue class _dlg_rsrcname

	// Get the Graphics object name (G) from the parent...
	parent_name.setvalue class PARENT._dlg_rsrcname
	parent_name.withvalue G.setvalue class @.G.value
	parent_name.withvalue tmajor.setvalue class @.tmajor.value
	program setLabel
END

PROGRAM setLabel
BEGIN
	call parent_name.withvalue axis.setvalue class @.child__MESSAGE.value
	if axis.iseq("xaxis") {
		call main.tx_value.setlabel "X axis value:"
	}
	if axis.iseq("yaxis") {
		call main.tx_value.setlabel "Y axis value:"
	}
END

DIALOG main, title("Add reference line") tabtitle("Main")
BEGIN
  TEXT     tx_value	_ilft	20	_wd	.,	///
	label("Axis value:") right
  EDIT     ed_value	_sep	@	_cbwd	.,	///
	nomemory label("Axis value")
END


PROGRAM command
BEGIN
	require main.ed_value
	/* validate value */
	put "gr_ed_axis_custom validateValue "
	put `"""' this_name `"""' " "
	put `"""' G `"""' " "
	put `"""' tmajor `"""' " "
	put `"""' axis `"""' " "
	put main.ed_value
	stata hidden
	if _rc {
		stopbox stop "Invalid value specified"
	}

	put main.ed_value
END
