public void showItem (TreeItem item) { checkWidget (); if (item == null) error (SWT.ERROR_NULL_ARGUMENT); if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); showItem (item.handle);
void showItem (int hItem) {  if (OS.SendMessage (handle, OS.TVM_GETVISIBLECOUNT, 0, 0) == 0) { boolean fixScroll = checkScroll (hItem); if (fixScroll) { OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0); } OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_FIRSTVISIBLE, hItem); OS.SendMessage (handle, OS.WM_HSCROLL, OS.SB_TOP, 0); if (fixScroll) { OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); } } else { boolean scroll = true; RECT itemRect = new RECT (); itemRect.left = hItem; if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, itemRect) != 0) { forceResize (); RECT rect = new RECT (); OS.GetClientRect (handle, rect); POINT pt = new POINT (); pt.x = itemRect.left; pt.y = itemRect.top; if (OS.PtInRect (rect, pt)) { pt.y = itemRect.bottom; if (OS.PtInRect (rect, pt)) scroll = false; } } if (scroll) { boolean fixScroll = checkScroll (hItem); if (fixScroll) { OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0); } OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hItem); if (fixScroll) { OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); } } } if (hwndParent != 0) { RECT itemRect = new RECT (); itemRect.left = hItem; if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, itemRect) != 0) { forceResize (); RECT rect = new RECT (); OS.GetClientRect (hwndParent, rect); OS.MapWindowPoints (hwndParent, handle, rect, 2); POINT pt = new POINT (); pt.x = itemRect.left; pt.y = itemRect.top; if (!OS.PtInRect (rect, pt)) { pt.y = itemRect.bottom; if (!OS.PtInRect (rect, pt)) { SCROLLINFO info = new SCROLLINFO (); info.cbSize = SCROLLINFO.sizeof; info.fMask = OS.SIF_POS; info.nPos = Math.max (0, pt.x - Tree.INSET / 2); OS.SetScrollInfo (hwndParent, OS.SB_HORZ, info, true); setScrollWidth (); } } } } updateScrollBar ();
public void showItem (TreeItem item) {	checkWidget ();	if (item == null) error (SWT.ERROR_NULL_ARGUMENT);	if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);	showItem (item.handle);}