We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I want a selected ListBox item appear in red and stay that way until I make another selection. How can I do this? At the moment it stays red as I click and hold down the mouse key then reverts to the original background color after I have let go. Is this the function of the method .setColorActive()?, or should it permanently change to the color I specified after it has been clicked? My code is below. Thanks.
list = controlp5.addListBox("LIST")
.setPosition(130, 40)
.setSize(100, 150)
.setItemHeight(20)
.setBarHeight(20)
.setColorBackground(color(40, 128))
.setColorActive(color(255, 0, 0))
Answers
.setColorActive is for when the mouse is clicked as you describe
what you want is .setColorForeground which would be the selected item
.setColorBackground would then of course be for items not selected.
Hi, please have a look at this work-in-progress version and the new ScrollableList, see example below in which the most recent clicked item stays highlighted.