LB-Make selection toggle column

From Vectorlab
Jump to: navigation, search


Procedure to create a List Browser's column with text-only, toggling between "checked/unchecked". No need to preload images. You need to load the sub-routine LB_ToggleColumn first. By Orso B. Schmid

{ Orso ********************************************* }
{ adds a 'select' icon to a LB, keep it ALWAYS BELOW the LB setup routine }
{ pass the icons' list indexes to checked/unchecked }
{ returns the column data items index of the loaded images }
{ pass -1 for a text-only toggle }
PROCEDURE LB_MakeSelToggleCol(d, LB: LONGINT; col: INTEGER; VAR checked, unchecked: INTEGER; display: INTEGER);
	BEGIN
		{ these needs the LB_AddSelectionIcons to be loaded }
		
		LB_ToggleColumn(d, LB, col, display); 
		{ kLBdsplImageOnly, kLBdispTextOnly, kLBdispImageAndText }
	
		unchecked := InsertLBColumnDataItem(d, LB, col, '-', unchecked, -1, 0);
		checked := InsertLBColumnDataItem(d, LB, col, '√', checked, -1, 0);
	END;