# G4P changing size of dropList Button

**URL:** <https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153>\
**Category:** Libraries\
**Created:** [June 21, 2018, 3:49pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153 "2018-06-21T15:49:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sonia](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Sonia](https://discourse.processing.org/u/Sonia)\
**Post date:** [June 21, 2018, 3:49pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/1 "2018-06-21T15:49:17Z")

</div>

Hello  
Is ther a way to change the size of the dropList Button please in G4P libraire?  
I would like to use it on a tactile screen and the button is very to small for easy touch.  
Thanks for your help !

Sonia

---

<div class="post-metadata">

**Author:** ![madscientist](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@madscientist](https://discourse.processing.org/u/madscientist)\
**Post date:** [June 21, 2018, 5:22pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/2 "2018-06-21T17:22:17Z")

</div>

Use the [G4P GUI builder tool](http://sourceforge.net/projects/guibuilder/files/?source=navbar).

---

<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:** [June 21, 2018, 7:54pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/3 "2018-06-21T19:54:34Z")

</div>

I assume that you mean the button on the right that expands the droplist. The height is controlled by the overall size of the control and the maximum number of list items shown when you create the control with the constructor

`GDropList(PApplet theApplet, float p0,float p1, float p2, float p3, int dropListMaxSize)`

button height = p3 / (droplistMaxSize + 1)

You cannot change the width.

---

<div class="post-metadata">

**Author:** ![Sonia](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Sonia](https://discourse.processing.org/u/Sonia)\
**Post date:** [June 22, 2018, 1:54pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/4 "2018-06-22T13:54:11Z")

</div>

Thank you for your answer,  
Yes i was talking about the button that expands thes droplist. I saw it is a protected variable in the GDropList class.  
Is it easy to compile the library if i change the value (10) in the GDropList class ? Sorry for my question, i never did it (compile a library)  
Or is there a way to extend the GDropList class and changing the value?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![madscientist](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@madscientist](https://discourse.processing.org/u/madscientist)\
**Post date:** [June 22, 2018, 9:14pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/5 "2018-06-22T21:14:49Z")

</div>

I don’t think you have to compile the library because processing automatically compiles it for you when you run your sketch. Just modify the library, and then `import` it.

---

<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:** [June 23, 2018, 1:07pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/6 "2018-06-23T13:07:56Z")

</div>

Processing expects libraries to be compiled ‘jar’ files. You can copy the library source code files into the sketch folder but the package declaration in each file would need to be deleted. This is NOT recommended.

---

<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:** [June 23, 2018, 1:23pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/7 "2018-06-23T13:23:36Z")

</div>

> Is it easy to compile the library if i change the value (10) in the GDropList class ? Sorry for my question, i never did it (compile a library)

If you are familiar with Eclipse then it is not too much of a problem.

> Or is there a way to extend the GDropList class and changing the value?

This would be the recommended technique and I have shown how to do this on other Processing forums for other controls. Unfortunately GDropList is a composite control in that it contains other G4P controls that are not publicly available i.e. the scrollbar.

So you have two alternatives

1. Modify the library source code, compile and jar it and add it to the sketch folder
2. Ask the library creator (me 😁) to add this as a feature for the next release.

---

<div class="post-metadata">

**Author:** ![madscientist](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@madscientist](https://discourse.processing.org/u/madscientist)\
**Post date:** [June 23, 2018, 3:51pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/8 "2018-06-23T15:51:57Z")

</div>

Oh, yeah I knew that. I was confusing it with PHP and the `include` statements.

---

<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:** [June 23, 2018, 4:07pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/9 "2018-06-23T16:07:21Z")

</div>

G4P 4.1.5 now allows you to specify the width of the button (and hence the scrollbar) when you create the control using a new constructor.

`GDropList(PApplet theApplet, float p0, float p1, float p2, float p3, int listSize, float buttonWidth)`

The button width is constrained between 10pixels and half the width of the control.

The new library is available for download now at [Sourceforge](https://sourceforge.net/projects/g4p/files/?source=navbar) or you can wait a couple of days until it becomes visible in Processing’s contributions manager.

---

<div class="post-metadata">

**Author:** ![madscientist](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@madscientist](https://discourse.processing.org/u/madscientist)\
**Post date:** [June 23, 2018, 4:10pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/10 "2018-06-23T16:10:01Z")

</div>

Will the GUI Builder be able to change the width?

---

<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:** [June 23, 2018, 4:48pm UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/11 "2018-06-23T16:48:23Z")

</div>

The GUI Builder can set the overall width of the control but not the button.

---

<div class="post-metadata">

**Author:** ![Sonia](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Sonia](https://discourse.processing.org/u/Sonia)\
**Post date:** [June 26, 2018, 9:08am UTC](https://discourse.processing.org/t/g4p-changing-size-of-droplist-button/1153/12 "2018-06-26T09:08:59Z")

</div>

Hello Quark  
Thank you so much for modifying your library !!!  
It works well now for tactile screen!  
Thanks a lot  
Have a nice day!  
Sonia
