LB-Set up List Browser from array

From Vectorlab
Jump to: navigation, search


Procedure to set up List Browser's columns from an array of string. Just pass the array and have the LB create by itself. By Orso B. Schmid


{ Orso ********************************************* }
{ set up a generic text LB from array count, override the columns attributes later in SetupDialogC! }
PROCEDURE LB_SetupFromArray(d, LB: LONGINT; colTitles: DYNARRAY[] OF STRING);
	VAR
		i, colNum, colCnt : INTEGER;
		temp_i: INTEGER;
		temp_b : BOOLEAN;
	BEGIN
		GetArrayDimensions(colTitles, temp_i, colCnt, temp_i, temp_i);
		{ gets count of columns }
		
		i := 0;
		WHILE i < colCnt DO BEGIN
			i := i + 1;
			IF NOT (colTitles[i] = '') THEN
				colNum := LB_InsertCol(d, LB, GetNumLBColumns(d, LB), 1, 0, 200, colTitles[i]); 
				{ width 200 is random px width: override later in setupDialogC! }
				{ 1 = controltype: owner none }
				{ 0 = display type: text only }
		END;

		EnableLBColumnLines(d, LB, TRUE); { draws column lines }
	END;