[ControlP5] Basics - dropdownList (how to close??)

edited September 2014 in Library Questions

is it possible that the dropdownList close when i click outside?

import controlP5.*;
ControlP5   cp5;

DropdownList l;

void setup() {
  size(1000, 500);
  cp5 = new ControlP5(this);
  l = cp5.addDropdownList("myList")
    .setPosition(100, 100)
      ;
  String[] fontList = PFont.list();
  for (int i=0; i<fontList.length; i++) {
    l.addItem(fontList[i], i);
  }
}
void draw() {
  background(90);
}

Answers

  • edited September 2014 Answer ✓

    is solved it:

    void mousePressed() {
      if (!l.isMouseOver()) {    
        l.close();
      }
    }
    

    :)

Sign In or Register to comment.