if (focusIndex != -1) setFocus ();
int kEventMouseDown (int nextHandler, int theEvent, int userData) {	int result = super.kEventMouseDown (nextHandler, theEvent, userData);	short [] button = new short [1];	OS.GetEventParameter (theEvent, OS.kEventParamMouseButton, OS.typeMouseButton, null, 2, null, button);	int [] clickCount = new int [1];	OS.GetEventParameter (theEvent, OS.kEventParamClickCount, OS.typeUInt32, null, 4, null, clickCount);	if (button [0] == 1 && clickCount [0] == 1) {		if (focusIndex != -1) setFocus ();		int sizeof = org.eclipse.swt.internal.carbon.Point.sizeof;		org.eclipse.swt.internal.carbon.Point pt = new org.eclipse.swt.internal.carbon.Point ();		OS.GetEventParameter (theEvent, OS.kEventParamMouseLocation, OS.typeQDPoint, null, sizeof, null, pt);		Rect rect = new Rect ();		int window = OS.GetControlOwner (handle);		OS.GetWindowBounds (window, (short) OS.kWindowContentRgn, rect);		int x = pt.h - rect.left;		int y = pt.v - rect.top;		OS.GetControlBounds (handle, rect);		x -= rect.left;		y -= rect.top;		int offset = layout.getOffset (x, y, null);		int oldSelectionX = selection.x;		int oldSelectionY = selection.y;		selection.x = offset;		selection.y = -1;		if (oldSelectionX != -1 && oldSelectionY != -1) {			if (oldSelectionX > oldSelectionY) {				int temp = oldSelectionX;				oldSelectionX = oldSelectionY;				oldSelectionY = temp;			}			Rectangle rectangle = layout.getBounds (oldSelectionX, oldSelectionY);			redraw (rectangle.x, rectangle.y, rectangle.width, rectangle.height, false);		}				for (int j = 0; j < offsets.length; j++) {			Rectangle [] rects = getRectangles (j);			for (int i = 0; i < rects.length; i++) {				Rectangle rectangle = rects [i];				if (rectangle.contains (x, y)) {					focusIndex = j;											redraw ();					return result;				}			}		}	}		int window = OS.GetControlOwner (handle);	int port = OS.GetWindowPort (window);	int [] outModifiers = new int [1];	short [] outResult = new short [1];	org.eclipse.swt.internal.carbon.Point outPt = new org.eclipse.swt.internal.carbon.Point ();	while (outResult [0] != OS.kMouseTrackingMouseUp) {		OS.TrackMouseLocationWithOptions (port, 0, OS.kEventDurationForever, outPt, outModifiers, outResult);		switch (outResult [0]) {			case OS.kMouseTrackingMouseDown:			case OS.kMouseTrackingMouseUp:			case OS.kMouseTrackingMouseDragged: {				int chord = OS.GetCurrentEventButtonState ();				if ((chord & 0x01) != 0) {					Rect rect = new Rect ();					OS.GetWindowBounds (window, (short) OS.kWindowContentRgn, rect);					int x = outPt.h;					int y = outPt.v;					OS.GetControlBounds (handle, rect);					x -= rect.left;					y -= rect.top;					int oldSelection = selection.y;					selection.y = layout.getOffset (x, y, null);					if (selection.y != oldSelection) {						int newSelection = selection.y;						if (oldSelection > newSelection) {							int temp = oldSelection;							oldSelection = newSelection;							newSelection = temp;						}						Rectangle rectangle = layout.getBounds (oldSelection, newSelection);						redraw (rectangle.x, rectangle.y, rectangle.width, rectangle.height, false);						update (); //CAUSING PROBLEMS					}				}									break;			}			default:				outResult [0] = OS.kMouseTrackingMouseUp;				break;		}	}		return result;}