Dlog-Load user pref LB column sizes

From Vectorlab
Jump to: navigation, search

Procedure to load List Browser's column sizes and sorting column from the file "SavedSettingsUser.xml". The values are separated by colon (";"). Use the routine D_StoreLBSizes to store the values. You need the routine T_ExtractCharSepNum to be loaded first. By Orso B. Schmid

{ Orso B. Schmid ************************************************ }
{ restores column size and sort column from SavedSettingsUser/XML }
{ if the file cannot be opened or the pref wasn't set before,it uses defaultSizes }
{ if the parm defaultSizes is empty AND no pref file, does nothing }
{ NOTE: takes a string separated by ";". Also for defaultSizes }
PROCEDURE D_LoadLBSizes(dID, LBid: LONGINT; XMLcategory, XMLelem: STRING; defaultSizes: STRING);
		cSC = chr(59);
		value : STRING; 
		i, w, numCols, sortCol :INTEGER;
		temp_b : BOOLEAN;
		IF NOT GetSavedSetting(XMLcategory, XMLelem, value) THEN
			value := defaultSizes;
		IF (Len(value) > 0) THEN BEGIN
			i := 0;
			numCols := GetNumLBColumns(dID, LBid);
			WHILE i < numCols DO BEGIN
				w := T_ExtractCharSepNum(value, cSC);
				IF w > 0 THEN
					temp_b := SetLBColumnWidth(dID, LBid, i, i, w);
				i := i + 1;
			IF validNumStr(value, sortCol) & IsLBSortingEnabled( dID, LBid) THEN
				IF sortCol > -1 THEN
					SetLBSortColumn(dID, LBid, sortCol, TRUE);