# G4P library with GUI builder - Drop down list

**URL:** https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213
**Category:** Libraries
**Created:** [January 20, 2020, 9:03pm UTC](https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213 "2020-01-20T21:03:50Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![laptophead](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/laptophead/32/2701_2.png) [@laptophead](https://discourse.processing.org/u/laptophead)
#### Post date: [January 20, 2020, 9:03pm UTC](https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213/1 "2020-01-20T21:03:50Z")

</div>

Peter I hope you read this, need some guidance please,

I am using for the first time the drop down, I have a list of 10 options but all I get is  
dropList1 - GDropList \>\> GEvent.SELECTED @ 14368  
dropList1 - GDropList \>\> GEvent.SELECTED @ 23314

For any of the option I choose.  
How do I extract the variable I chose in the option list file?

Thank you

---

<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: [January 21, 2020, 9:16am UTC](https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213/2 "2020-01-21T09:16:13Z")

</div>

If you look in the **gui** tab you will see the event handler for your droplist. Inside there you will see the code that produces the output you posted.

You can get the item index and text with

```auto
dropList1.getSelectedIndex(); // returns an int
dropList1.getSelectedText(); // returns a String

```

Make sure any code you add to the **gui** tab is _inside_ the event handler.

---

<div class="post-metadata">

### Author: ![laptophead](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/laptophead/32/2701_2.png) [@laptophead](https://discourse.processing.org/u/laptophead)
#### Post date: [January 21, 2020, 5:16pm UTC](https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213/3 "2020-01-21T17:16:37Z")

</div>

Great, it worked.

Did you write a user guid that explains this?

How to get data from a text box for instance, and other functions?

Thanks a lot, love the library and tool  
Mich

PS  
Is there a setting the make the click response faster. Meaning, I have to hold the mouse down for about 500mS to get a response. I am powering a robot and I need to turn off motors fast,

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: [January 21, 2020, 5:34pm UTC](https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213/4 "2020-01-21T17:34:04Z")

</div>

> [@laptophead](#):
>
> I have to hold the mouse down for about 500mS to get a response.

Do not hold the mouse button down simply click on the button for the drop list to appear

> [@laptophead](#):
>
> Did you write a user guid that explains this?
> 
> How to get data from a text box for instance, and other functions?

There are guides on my [website for G4P](http://www.lagers.org.uk/g4p/guides/g01-introduction.html), you can look at the [API class reference documentation](http://www.lagers.org.uk/g4p/ref/index.html) and there are examples that come with the library for you to experiment with.

---

<div class="post-metadata">

### Author: ![laptophead](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/laptophead/32/2701_2.png) [@laptophead](https://discourse.processing.org/u/laptophead)
#### Post date: [February 18, 2020, 1:59am UTC](https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213/5 "2020-02-18T01:59:06Z")

</div>

I am using a checkbox for the first time using the builder.

I looked at the examples but I could not find out how to get the boolean from the box being checked or not,

I tried boolean CkBox = source.getBoolean();

But did not work, Please help  
Thank you,  
Mitch

---

<div class="post-metadata">

### Author: ![mala](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@mala](https://discourse.processing.org/u/mala)
#### Post date: [February 18, 2020, 9:19am UTC](https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213/6 "2020-02-18T09:19:16Z")

</div>

You want to use `.isSelected()` I think.

---

<div class="post-metadata">

### Author: ![laptophead](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/laptophead/32/2701_2.png) [@laptophead](https://discourse.processing.org/u/laptophead)
#### Post date: [February 18, 2020, 5:31pm UTC](https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213/7 "2020-02-18T17:31:16Z")

</div>

Thanks  
That worked. Would it be the same for the Option boxes?

---

<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: [February 18, 2020, 5:48pm UTC](https://discourse.processing.org/t/g4p-library-with-gui-builder-drop-down-list/17213/8 "2020-02-18T17:48:20Z")

</div>

Yes its the same for any control that can be selected / deselected including checkboxes
