public void setfocus(Widget w) {
		if (focusctl) {
			if (w != focused) {
				Widget last = focused;
				focused = w;
				if (last != null)
					last.hasfocus = false;
				w.hasfocus = true;
				if (last != null)
					last.lostfocus();
				w.gotfocus();
				if ((ui != null) && ui.rwidgets.containsKey(w))
					wdgmsg("focus", ui.rwidgets.get(w));
			}
			if (parent != null)
				parent.setfocus(this);
		} else {
			parent.setfocus(w);
		}
	}