void setScrollWidth (int scrollWidth) { forceResize (); RECT rect = new RECT (); OS.GetClientRect (handle, rect); this.scrollWidth = Math.max (0, scrollWidth); int newWidth = Math.max (this.scrollWidth, rect.right - rect.left); OS.SendMessage (handle, OS.LVM_SETCOLUMNWIDTH, 0, newWidth);
boolean setScrollWidth (TableItem item, boolean force) { if (currentItem != null) { if (currentItem != item) fixScrollWidth = true; return false; } if (!force && (drawCount != 0 || !OS.IsWindowVisible (handle))) { fixScrollWidth = true; return false; } fixScrollWidth = false;  if (columnCount == 0) { int newWidth = 0, imageIndent = 0, index = 0; int itemCount = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0); while (index < itemCount) { String string = null; int font = -1; if (item != null) { string = item.text; imageIndent = Math.max (imageIndent, item.imageIndent); if (item.cellFont != null) font = item.cellFont [0]; if (font == -1) font = item.font; } else { if (items [index] != null) { TableItem tableItem = items [index]; string = tableItem.text; imageIndent = Math.max (imageIndent, tableItem.imageIndent); if (tableItem.cellFont != null) font = tableItem.cellFont [0]; if (font == -1) font = tableItem.font; } } if (string != null && string.length () != 0) { if (font != -1) { int hDC = OS.GetDC (handle); int oldFont = OS.SelectObject (hDC, font); int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX; TCHAR buffer = new TCHAR (getCodePage (), string, false); RECT rect = new RECT (); OS.DrawText (hDC, buffer, buffer.length (), rect, flags); OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); newWidth = Math.max (newWidth, rect.right - rect.left); } else { TCHAR buffer = new TCHAR (getCodePage (), string, true); newWidth = Math.max (newWidth, OS.SendMessage (handle, OS.LVM_GETSTRINGWIDTH, 0, buffer)); } } if (item != null) break; index++; }  if (newWidth == 0) { TCHAR buffer = new TCHAR (getCodePage (), " ", true); newWidth = Math.max (newWidth, OS.SendMessage (handle, OS.LVM_GETSTRINGWIDTH, 0, buffer)); } int hStateList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_STATE, 0); if (hStateList != 0) { int [] cx = new int [1], cy = new int [1]; OS.ImageList_GetIconSize (hStateList, cx, cy); newWidth += cx [0] + INSET; } int hImageList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0); if (hImageList != 0) { int [] cx = new int [1], cy = new int [1]; OS.ImageList_GetIconSize (hImageList, cx, cy); newWidth += (imageIndent + 1) * cx [0]; } else {  newWidth++; } newWidth += INSET * 2; int oldWidth = OS.SendMessage (handle, OS.LVM_GETCOLUMNWIDTH, 0, 0); if (EXPLORER_THEME) { if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { newWidth += EXPLORER_EXTRA; } } if (newWidth > oldWidth) {  boolean redraw = drawCount == 0 && OS.IsWindowVisible (handle); if (redraw) OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0); OS.SendMessage (handle, OS.LVM_SETCOLUMNWIDTH, 0, newWidth); if (redraw) { OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); if (OS.IsWinCE) { int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); if (hwndHeader != 0) OS.InvalidateRect (hwndHeader, null, true); OS.InvalidateRect (handle, null, true); } else { int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; OS.RedrawWindow (handle, null, 0, flags); } } return true; } } return false;
void setScrollWidth (int scrollWidth) {	forceResize ();	RECT rect = new RECT ();	OS.GetClientRect (handle, rect);	this.scrollWidth = Math.max (0, scrollWidth);	int newWidth = Math.max (this.scrollWidth, rect.right - rect.left);	OS.SendMessage (handle, OS.LVM_SETCOLUMNWIDTH, 0, newWidth);}