G4P changing size of dropList Button

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

Use the G4P GUI builder tool.

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.

1 Like

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!

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.

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.

1 Like

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 :grin:) to add this as a feature for the next release.
1 Like

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

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 or you can wait a couple of days until it becomes visible in Processing’s contributions manager.

1 Like

Will the GUI Builder be able to change the width?

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

1 Like

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