Example #1
0
 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;
     }
   }
 }
Example #2
0
 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);
   }
 }
Example #3
0
 public void lostfocus() {
   if (focusctl && (focused != null)) {
     focused.hasfocus = false;
     focused.lostfocus();
   }
 }
Example #4
0
 public void gotfocus() {
   if (focusctl && (focused != null)) {
     focused.hasfocus = true;
     focused.gotfocus();
   }
 }