private void findfocus() { /* XXX: Might need to check subwidgets recursively */ focused = null; for (Widget w = lchild; w != null; w = w.prev) { if (w.visible && w.autofocus) { focused = w; if (hasfocus) { focused.hasfocus = true; w.gotfocus(); } break; } } }
public void setfocus(Widget w) { if (focusctl) { if (w != focused) { Widget last = focused; focused = w; if (hasfocus) { if (last != null) last.hasfocus = false; w.hasfocus = true; if (last != null) last.lostfocus(); w.gotfocus(); } else if ((last != null) && last.hasfocus) { /* Bug, but ah well. */ last.hasfocus = false; last.lostfocus(); } if ((ui != null) && ui.rwidgets.containsKey(w) && ui.rwidgets.containsKey(this)) wdgmsg("focus", ui.rwidgets.get(w)); } if ((parent != null) && visible && canfocus) parent.setfocus(this); } else { parent.setfocus(w); } }
public void gotfocus() { if (focusctl && (focused != null)) { focused.hasfocus = true; focused.gotfocus(); } }