-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrols.pde
30 lines (26 loc) · 1.01 KB
/
controls.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//here we setup the dropdown list.
void customize(DropdownList ddl) {
ddl.setBackgroundColor(color(190));
ddl.setItemHeight(20);
ddl.setBarHeight(15);
ddl.addItem("Filter", 0);
ddl.addItem("1Euro", 1);
ddl.addItem("No Filter", 1);
ddl.setColorBackground(color(60));
ddl.setColorActive(color(255, 128));
}
void controlEvent(ControlEvent theEvent) {
// DropdownList is of type ControlGroup.
// A controlEvent will be triggered from inside the ControlGroup class.
// therefore you need to check the originator of the Event with
// if (theEvent.isGroup())
// to avoid an error message thrown by controlP5.
if (theEvent.isGroup()) {
// check if the Event was triggered from a ControlGroup
println("event from group : "+theEvent.getGroup().getValue()+" from "+theEvent.getGroup());
filterMode = (int)theEvent.getGroup().getValue();
}
else if (theEvent.isController()) {
println("event from controller : "+theEvent.getController().getValue()+" from "+theEvent.getController());
}
}