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 Window(Coord c, Coord sz, Widget parent, String cap) { super(c, new Coord(0, 0), parent); if (cap != null) { this.cap = cf.render(cap); name = cap; } else { this.cap = null; name = null; } resize(sz); setfocustab(true); parent.setfocus(this); cbtn = new IButton(Coord.z, this, cbtni[0], cbtni[1], cbtni[2]); cbtn.recthit = true; addtwdg(cbtn); loadOpts(); }