//////////////////////////////////////////////////////////////////////
// Filename:		SelectCat.OGS
// Purpose:		Labtalk for Select Category dialog
// Creation:		by Scott Bertrand, 11/21/2001
// Modifications:
//  RVD 7/19/2002 QA70-1860 v7.0346 NLSF_BETTER_ADD_FUNCTION
/// ML 8/2/2002 QA70-1860 REWRITING_ADDING_FUNCTIONS
/// Jasmine 09/18/07 QA70-10378 REMOVE_CATCHECK_CHECKBOX
//////////////////////////////////////////////////////////////////////

[OnInit]
	ini.get.filename$=nlsf.ini;
	ini.getsection(Category);
	loop(ii,1,ini.keynum)
	{
		%B=ini.keyname$(ii)$;
		SelectCat!CatList.v$(ii)$=%B;
	}
	SelectCat!CatList.choice=1;
	%B=SelectCat!CatList.v$(SelectCat!CatList.choice)$;
	SelectCat!CatEdit.v1$=%B;
	return 0;

[CatOK.OnClick]
	%B=SelectCat!CatEdit$;
	/// RVD 7/19/2002 QA70-1860 v7.0346 NLSF_BETTER_ADD_FUNCTION
	//nlsf.addfunc(%B,%A);
	/// ML 8/2/2002 QA70-1860 REWRITING_ADDING_FUNCTIONS
	//dwCntrl = SelectCat!CatCheck;
	//nlsf.addfunc(%B,%A,dwCntrl);
	// Do the same as for menu item adding in Adv. Tool and for wizard
	// (third argument being 0 means "smart" adding where the method itself figures out whether
	// it should ask to copy or not). The method returns 0 if the function was added, otherwise nonzero.
	nlsf.addfunc(%B,%A,0);
	/// end REWRITING_ADDING_FUNCTIONS
	/// end NLSF_BETTER_ADD_FUNCTION
	dialog.close(OTools,SelectCat);
	return 0;

[CatCancel.OnClick]
	dialog.close(OTools,SelectCat);
	return 0;

[CatList.OnSelchange]
	%B=SelectCat!CatList.v$(SelectCat!CatList.choice)$;
	SelectCat!CatEdit.v1$=%B;
	SelectCat!CatEdit.Select(1,%[%B]+1);
	SelectCat!CatEdit.Setfocus();
	return 0;

[CatEdit.OnPressEnter]
	%B=SelectCat!CatEdit$;
	/// RVD 7/19/2002 QA70-1860 v7.0346 NLSF_BETTER_ADD_FUNCTION
	dwCntrl = 0;//SelectCat!CatCheck;	///Jasmine 09/18/07 QA70-10378 REMOVE_CATCHECK_CHECKBOX, see reason with REWRITING_ADDING_FUNCTIONS
	/// end NLSF_BETTER_ADD_FUNCTION
	if(%[%B]>0)
	{
		/// RVD 7/19/2002 QA70-1860 v7.0346 NLSF_BETTER_ADD_FUNCTION
		//nlsf.addfunc(%B,%A);
		nlsf.addfunc(%B,%A,dwCntrl);
		/// end NLSF_BETTER_ADD_FUNCTION
	}
	else
	{
		%B=SelectCat!CatList.v$(SelectCat!CatList.choice)$;
		SelectCat!CatEdit.v1$=%B;
		/// RVD 7/19/2002 QA70-1860 v7.0346 NLSF_BETTER_ADD_FUNCTION
		//nlsf.addfunc(%B,%A);
		nlsf.addfunc(%B,%A,dwCntrl);
		/// end NLSF_BETTER_ADD_FUNCTION
	}
	dialog.close(OTools,SelectCat);
	return 0;

