/*
	encode
	
*!  VERSION 1.0.3  10jun2011

*/

VERSION 8.0

INCLUDE _std_small
INCLUDE _ht210
INCLUDE header
HELP hlp1, view("help encode")
RESET res1

DIALOG main,label("encode - Encode string into numeric")              /*
		*/	tabtitle("Main")
BEGIN
  /*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+*/
   TEXT	    tx_var        _lft	    _top      _cwd1	.,            /*
		*/	label("Source-string variable:")
	
   VARNAME  vn_var        @         _ss       _vnwd     .,            /*
                */      label("String-string variable")

   TEXT     tx_newvar     _lft2     _top      _cwd1     .,            /*
                */      label("New-numeric variable:")

   EDIT     ed_newvar     @         _ss       _vnwd     .,            /*
                */      label("New-numeric variable")                 /*
                */      option(generate)                              /*
		*/      max(32)

   GROUPBOX gb_label      _lft      +35       _iwd      _ht9,        /*
                */      label("Value label") 

   RADIO    rb_default    _ilft     _ss       _ibwd     .,            /*
                */      label("Name value label the same as new variable name") /*
                */      first                                         /*
                */      clickon("script name_off")                    

   RADIO    rb_name       @         _ss       _ibwd     .,            /*
                */      label("Specify value label name:")	      /*
                */      last                                          /*
                */      clickon("script name_on")                     

   EDIT     ed_name       +20       _ss       _vnwd     .,            /*
                */      label("Value label name")                     /*
                */      max(32)                                       /*
                */      option(label)

   CHECKBOX ck_noextend  _ilft      _ls       _ibwd     .,            /*
                */      label("Do not extend existing value label")   /*
                */      option(noextend)
END

INCLUDE ifin

PROGRAM command
BEGIN
	put "encode "
	varlist main.vn_var
	INCLUDE _ifin_pr 
	beginoptions
		require main.ed_newvar
	        optionarg main.ed_newvar	
		if main.rb_name{
			optionarg main.ed_name
		}
		option main.ck_noextend
	endoptions
END

SCRIPT name_off
BEGIN
	main.ed_name.disable
	main.ck_noextend.disable
END

SCRIPT name_on
BEGIN
	main.ed_name.enable
	main.ck_noextend.enable
END

