LB-Get last selected row

From Vectorlab
Jump to: navigation, search


Get last selected row in a List Browser. Returns the string (or empty string) and the image (or -1). By Orso B. Schmid

{ Orso ******************************************** }
{ **** THIS MUST RESIDE IN THE LB CASE STATEMENT OF THE DIALOG DRIVER **** }
{ gets last selected LB row passing a col which must not be the one clicked! }
{ sets as var the string in the cell, the image values; returns the index of the row }
{ last row, because GetLBEventInfo returns the last selected }
FUNCTION LB_GetLastSelRow(d, LB: LONGINT; col: INTEGER; VAR LBstr: STRING; VAR LBimg: INTEGER): INTEGER;
	VAR
		event, eventRow, eventCol : INTEGER;

	BEGIN
		LB_GetLastSelRow := -1;
		LBstr := '';
		
		IF GetNumLBItems(d, LB) > 0 THEN
			IF GetLBEventInfo(d, LB, event, eventRow, eventCol) & GetLBItemInfo(d, LB, eventRow, col, LBstr, LBimg) THEN
				LB_GetLastSelRow := eventRow;
	END;