I have the following function to generate a GUI and I want to create a number of buttons based on the number of items in an array. When the button is clicked I want to pass the appropriate struct to a function.
plants is an array of structs
When I click the button, I want to pass the appropriate plant to the specified function
The buttons get created properly, but they all pass the last item of the array since that was the last value of plant.
I have the following function to generate a GUI and I want to create a number of buttons based on the number of items in an array. When the button is clicked I want to pass the appropriate struct to a function.
plants is an array of structs When I click the button, I want to pass the appropriate plant to the specified function The buttons get created properly, but they all pass the last item of the array since that was the last value of plant.