I’m having trouble using a droplist. I’ve looked at the examples and read through the user guides on the web site, but I can’t see what I’m doing wrong. In all the examples I’ve tried, the droplist collapses after the user makes a selection, but when I run the code below, the list never collapses (although the selection is returned to the program). What am I doing wrong?
import g4p_controls.*;
String dest[] = {"Selection 1","Selection 2","Selection 3"};
GDropList dropList1;
public void setup() {
size(600,400,JAVA2D);
G4P.messagesEnabled(false);
G4P.setMouseOverEnabled(false);
dropList1 = new GDropList(this, 20, 20, 120, 200, 10);
dropList1.addEventHandler(this, "dropListHandler");
dropList1.setItems(dest,0);
}
public void draw() {
}
public void dropListHandler (GDropList source, GEvent event) {
println("dropList >> GEvent." + event + " @ " + millis());
println("selected text = "+source.getSelectedText());
}