Пример #1
0
  public void controlEvent(ControlEvent theEvent) {
    // PulldownMenu is if type ControlGroup.
    // A controlEvent will be triggered from within the ControlGroup.
    // therefore you need to check the originator of the Event with
    // if (theEvent.isGroup())
    // to avoid an error message from controlP5.
    if (theEvent.isGroup()) {
      if (theEvent.group().name() == "ruleChoiceList") {
        //    println(theEvent.group().value()+" from "+theEvent.group());
        selectedRule = PApplet.parseInt(theEvent.group().value());
        // has to be here for the controlp5 library
      }
    } else if (theEvent.isController()) {
      //    println(theEvent.controller().value()+" from "+theEvent.controller());
    }

    //  switch(theEvent.controller().id()) {
    //    case(1):
    //    myColorRect = (int)(theEvent.controller().value());
    //    break;
    //    case(2):
    //    myColorBackground = (int)(theEvent.controller().value());
    //    break;
    //    case(3):
    //    println(theEvent.controller().stringValue());
    //    break;
    //  }

  }
Пример #2
0
 public void controlEvent(ControlEvent theEvent) {
   if (theEvent.isGroup()) {
     if (theEvent.group().name() == "optionsbox") {
       for (int i = 0; i < theEvent.group().arrayValue().length; i++) {
         optionsArray[i] = (int) theEvent.group().arrayValue()[i];
       }
       if (optionsArray[0] == 1) {
         translator = true;
       } else {
         translator = false;
       }
     }
   }
 }