Пример #1
0
 public boolean type(char key, KeyEvent ev) {
   if (canactivate) {
     if (key == 10) {
       wdgmsg("activate");
       return (true);
     }
   }
   if (cancancel) {
     if (key == 27) {
       wdgmsg("cancel");
       return (true);
     }
   }
   if (focusctl) {
     if (focused != null) {
       if (focused.type(key, ev)) return (true);
       if (focustab) {
         if (key == '\t' && !Config.agroclosest) {
           Widget f = focused;
           while (true) {
             if ((ev.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
               Widget n = f.rnext();
               f = ((n == null) || !n.hasparent(this)) ? child : n;
             } else {
               Widget p = f.rprev();
               f = ((p == null) || !p.hasparent(this)) ? lchild : p;
             }
             if (f.canfocus) break;
           }
           setfocus(f);
           return (true);
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     } else {
       return (false);
     }
   } else {
     for (Widget wdg = child; wdg != null; wdg = wdg.next) {
       if (wdg.visible) {
         if (wdg.type(key, ev)) return (true);
       }
     }
     return (false);
   }
 }
Пример #2
0
 public void delfocusable(Widget w) {
   if (focusctl) {
     if ((focused != null) && focused.hasparent(w)) {
       findfocus();
     }
   } else {
     if (parent != null) parent.delfocusable(w);
   }
 }