Variable # of ButtonFields and Methods

Hello all, I have a question that I can't solve with my current knowledge, and couldn't find an alternate solution on the internet. So here it goes:

I want to add variable number of buttonfields (depending on the data coming from the database). But the problem is how to fire the clicking event of the buttons ? There is the sample code I've written:

please don't be worried about any variable names etc, the only problem is I can't see nameID and stateID on the console. so somehow the buttons I created in this loop don't do their events. What should I do ?

Re: Variable # of ButtonFields and Methods

if you create the button with consume_click navigationclick is not executed. you can do either one, not both.if you return true in your navigationclick the button consumes it as well.another option is a fielchangelistener (with consume_click)

there are several possible approaches to identify your buttons if you use a fieldchangelistener:the easiest would be to store all added buttons in a data structure like a vector. you can decide which action to take by index.you could also create your own class that extends button and features an identifier, similar to html buttons that have both a label and an (invisible) command.

----------------------------------------------------------feel free to press the like button on the right side to thank the user that helped you.please mark posts as solved if you found a solution.@SimonHain on twitter

Re: Variable # of ButtonFields and Methods

thanks, implementing the field change listener and storing the buttonfields in a vector solved the problem. Although this is the first time I really look for the addressing in the C++, since you can't pass the reference of an object in java. Thanks anyways, I get it working now.