# Question about GDropList in G4P library

**URL:** https://discourse.processing.org/t/question-about-gdroplist-in-g4p-library/20045
**Category:** Libraries
**Created:** [April 22, 2020, 9:02pm UTC](https://discourse.processing.org/t/question-about-gdroplist-in-g4p-library/20045 "2020-04-22T21:02:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![David](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/david/32/8853_2.png) [@David](https://discourse.processing.org/u/David)
#### Post date: [April 22, 2020, 9:02pm UTC](https://discourse.processing.org/t/question-about-gdroplist-in-g4p-library/20045/1 "2020-04-22T21:02:28Z")

</div>

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?

```auto
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());
}

```

---

<div class="post-metadata">

### Author: ![David](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/david/32/8853_2.png) [@David](https://discourse.processing.org/u/David)
#### Post date: [April 23, 2020, 1:04pm UTC](https://discourse.processing.org/t/question-about-gdroplist-in-g4p-library/20045/2 "2020-04-23T13:04:39Z")

</div>

@quark I’m not sure if this is a bug or just something I don’t understand, but I discovered that if I added a line to the draw() method, it works. Here’s what the draw() method looks like now:

```auto
public void draw() {
  background(230);
}

```

That’s the only change I made. Is this expected behaviour?

Thanks.

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [April 23, 2020, 1:57pm UTC](https://discourse.processing.org/t/question-about-gdroplist-in-g4p-library/20045/3 "2020-04-23T13:57:44Z")

</div>

This is not a bug, G4P _ **requires** _ you to use either background() or some other command to remove the previous control image for every frame.
