LB-Set number cell

From Vectorlab
Jump to: navigation, search


Function to set a List Browser's cell to number, fixing all: padding number, justification. By Orso B. Schmid

{ Orso ********************************************* }
{ loads a number cell, can be used on any type of column control (exept radio) }
FUNCTION LB_NumCellSet(d, LB: LONGINT; row, col: INTEGER; num: REAL; howManyPads: INTEGER): BOOLEAN;
	VAR
		numStr : STRING;
		temp_b : BOOLEAN;
		
	BEGIN
		LB_NumCellSet := TRUE;
		
		numStr := Concat(num);
		IF Pos('-', numStr) = 0 THEN
			WHILE (Len(numStr) < howManyPads) DO
				numStr := Concat('0', numStr);
			
		{ 7: kLBTxtOwnerDrawn }
		IF SetLBColumnOwnerDrawnType(d, LB, row, col, 7) THEN BEGIN
			temp_b := SetLBItemInfo(d, LB, row, col, numStr, -1);
			temp_b := SetLBItemTextJust(d, LB, row, col, 3); { align right }
		END ELSE
			LB_NumCellSet := FALSE;
	END;