LB-Attributes cell

From Vectorlab
Jump to: navigation, search


Procedure to set a List Browser's cell to display attributes, fixing automatically owner types. I don't remember if this was really working perfectly. You need to load the sub-routine LB_ToggleColumn first. By Orso B. Schmid

{ Orso ********************************************* }
{ sets up the attributes of a cell with resources: colors, hatches, gradients, images }
{ use LB_ImgColumn to set up the columns }
{ use a color index for vecFillIndex in order to have a color cell }
{ watch for eventual pattern fills, which will be positive and thus give false results }
PROCEDURE LB_AttrCell(d, LB: LONGINT; row, col: INTEGER; vecFillIndex, r, g, b: LONGINT);
	VAR
		vecFillN : STRING;
		temp_b : BOOLEAN;
		
	BEGIN
		CASE vecFillIndex OF
		
			{ KLBBlankOwnerDrawn is empty fill }
			0:	temp_b := SetLBColumnOwnerDrawnType(d, LB, row, col, 6); 
			
			1:	LB_ColorCell(d, LB, row, col, r, g, b);
				
			OTHERWISE BEGIN
				{ negative val is hatch or gradient or image }
				IF vecFillIndex < 0 THEN
					vecFillIndex := -vecFillIndex;
			
				vecFillN := index2Name(vecFillIndex);
				IF Len(vecFillN) > 0 THEN
					CASE GetType(GetObject(vecFillN)) OF
				
						{ image, gradient, symbol }
						119, 120, 16: 	
							IF SetLBColumnOwnerDrawnType(d, LB, row, col, 5) THEN	{ 5: Gradient or image }
								temp_b := SetLBItemGradientOrImageRefNumber(d, LB, row, col, vecFillIndex);
							
						{ hatch }
						66:
							IF SetLBColumnOwnerDrawnType(d, LB, row, col, 7) THEN { 7: Text }
								temp_b := SetLBItemInfo(d, LB, row, col, vecFillN, -1);
							
						OTHERWISE
							LB_ColorCell(d, LB, row, col, r, g, b);
							
					END; { case }
			END;
		END;
	END;