if (!redraw && drawCount == 1) { OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
if (redraw) { if (drawCount == 0) OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); } else { if (drawCount == 1) OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
public void setRedraw (boolean redraw) {	checkWidget ();	/*	* Bug in Windows.  For some reason, when WM_SETREDRAW	* is used to turn redraw on for a tree and the tree	* contains no items, the last item in the tree does	* not redraw properly.  If the tree has only one item,	* that item is not drawn.  If another window is dragged	* on top of the item, parts of the item are redrawn	* and erased at random.  The fix is to ensure that this	* case doesn't happen by inserting and deleting an item	* when redraw is turned on and there are no items in	* the tree.	*/	int hItem = 0;	if (redraw && drawCount == 1) {		int count = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);		if (count == 0) {			TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT ();			tvInsert.hInsertAfter = OS.TVI_FIRST;			hItem = OS.SendMessage (handle, OS.TVM_INSERTITEM, 0, tvInsert);		}	}	super.setRedraw (redraw);	/*	* Feature in Windows.  When WM_SETREDRAW is used to	* turn off redraw, the scroll bars are updated when	* items are added and removed.  The fix is to call	* the default window proc to stop all drawing.	*/	if (!redraw && drawCount == 1) {		OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);	}	if (hItem != 0) {		ignoreShrink = true;		OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, hItem);		ignoreShrink = false;	}}