We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone,
So I have two dropdown list menus. One of them chooses an activity folder and the second chooses the events in the activity folder. I only want the second dropdown list to show up when the user chooses an activity in the first dropdown menu. I can do this with .hide() and .show(), but the I am not quite sure how to detect when the user has actually chose something. I saw that people use the void controlEvent(){} but this activates for all controllers, so it might get a little funky with two drop down menus(i also have a slider).
Oh yeah one side question: How does changing the label font size work? By default its pretty small and hard to read.
Thanks!
Answers
ControlEvent would be the way to go. Use this structure:
Thanks!!! That's what I needed exactly! Would you happen to know how to change the font size of the dropDownList?
You can use
cp5.setFont(PFont font)
to change the font of all items. Don't forget to change the size of the dropdownlist accordingly...Is there a way to target one thing only like men1.setFont(PFont font) instead of all of them? I also have a slider that I want to keep the default font size.
edit: dropdownlist.addItems() takes in an arraylist of strings as its parameters. However, I need to sort the arrayist by the numeric value. Collections.sort(arraylist) will only sort it like: 1, 123, 2, 222, 3, 4, 53, 6.
But I would need them sorted like 1, 2, 3, 4, 6, 53, 123, 222. Because of this i stored the values as an arraylist of integers to sort. But now I'm having problems adding the list into the dropwdownlist. Do you have any ideas?
That's a hard one as the sorting is using a nonstandard rule. You can try to define your own Comparator (Google will be much better than me at explaining this). If the list is always the same and not very long you're better off sorting it yourself.