Dlog-Load user pref number

From Vectorlab
Jump to: navigation, search


Function to retrive a user preference as number from the file "SavedSettingsUser.xml", if it fails it will return a default value. The preferences must be set beforehand using the routine "SetSavedSetting". By Orso B. Schmid


{ Orso B. Schmid ************************************************ }
{ loads whatever user setting from SavedSettingsUser/XML: NUMBER }
{ if this fails, it sets a predefined default value }
FUNCTION D_LoadUserPrefNum(XMLcategory, XMLelem: STRING; defVal: REAL): REAL;
	VAR 
		value : STRING;
		num : REAL;
		
	BEGIN
		D_LoadUserPrefNum := defVal;
		
		IF GetSavedSetting(XMLcategory, XMLelem, value) THEN
			IF ValidNumStr(value, num) THEN
				D_LoadUserPrefNum := num;
	END;