Hello,
I have a ListBox in my GUI. I want that if you click on a listItem, an event gets activated.
I have googled but I don’t really understand how to do this.
It is important to know which listItem is clicked on. I also want to have a parameter passed to the event method like a number.
This is how I add my items to the listbox:
ListBox listBox = screen.findNiftyControl("user-list", ListBox.class); listBox.addItem("User 1"); // If this listItem becomes selected, the parameter 1 should be passed to the event method, like: listItemSelected(1); listBox.addItem("User 2"); // Pass parameter 2 to event method. Like: listItemSelected(2); // ...