LB-Make number cell at column zero

From Vectorlab
Jump to: navigation, search

Function to insert a row in a List Browser setting the first cell (index zero) to number. It pads the number string to ensure a proper column sorting. Returns the row index. By Orso B. Schmid

{ Orso ********************************************* }
{ Creates and loads a number cell at the column 0, can be used on any type of column control (exept radio) }
FUNCTION LB_NumCellCreate(d, LB: LONGINT; row: INTEGER; num: REAL; howManyPads: INTEGER): INTEGER;
		numStr : STRING;
		temp_b : BOOLEAN;
		numStr := Concat(num);
		IF Pos('-', numStr) = 0 THEN
			WHILE (Len(numStr) < howManyPads) DO
				numStr := Concat('0', numStr);
		row := InsertLBItem(d, LB, row, numStr);
		{ 7: kLBTxtOwnerDrawn }
		IF SetLBColumnOwnerDrawnType(d, LB, row, 0, 7) THEN
			temp_b := SetLBItemTextJust(d, LB, row, 0, 3); { align right }
		LB_NumCellCreate := row;