OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, i, newRect); if (newRect.left != oldRects [i].left) {
if (order [i] != oldOrder [i]) {
public void setColumnOrder (int [] order) {	checkWidget ();	if (order == null) error (SWT.ERROR_NULL_ARGUMENT);	int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);	int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0 );	if (count == 1 && columns [0] == null) {		if (order.length != 0) error (SWT.ERROR_INVALID_ARGUMENT);		return;	}	if (order.length != count) error (SWT.ERROR_INVALID_ARGUMENT);	int [] oldOrder = new int [count];	OS.SendMessage (handle, OS.LVM_GETCOLUMNORDERARRAY, count, oldOrder);	boolean reorder = false;	boolean [] seen = new boolean [count];	for (int i=0; i<order.length; i++) {		int index = order [i];		if (index < 0 || index >= count) error (SWT.ERROR_INVALID_RANGE);		if (seen [index]) error (SWT.ERROR_INVALID_ARGUMENT);		seen [index] = true;		if (index != oldOrder [i]) reorder = true;	}	if (reorder) {		RECT [] oldRects = new RECT [count];		for (int i=0; i<count; i++) {			oldRects [i] = new RECT ();			OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, i, oldRects [i]);		}		OS.SendMessage (handle, OS.LVM_SETCOLUMNORDERARRAY, order.length, order);		/*		* Bug in Windows.  When LVM_SETCOLUMNORDERARRAY is used to change		* the column order, the header redraws correctly but the table does		* not.  The fix is to force a redraw.		*/		OS.InvalidateRect (handle, null, true);		TableColumn[] newColumns = new TableColumn [count];		System.arraycopy (columns, 0, newColumns, 0, count);		RECT newRect = new RECT ();		for (int i=0; i<count; i++) {			TableColumn column = newColumns [i];			if (!column.isDisposed ()) {				OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, i, newRect);				if (newRect.left != oldRects [i].left) {					column.sendEvent (SWT.Move);				}			}		}	}}