Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 2
Registered: ‎08-25-2009
My Device: Storm 9530 v4.7.0.148
Accepted Solution

ObjectChoiceField and FieldChangeListener

I am creating an app (Storm 9530 Component Package 4.7) that uses an ObjectChoiceField that is filled programatically with anywhere from 1 to 50 choices.  I would like to use the FieldChangeListener to generate a new popup screen based on the selection made by the user from the ObjectChoiceField.  Because the list can be quite long, the user may need to scroll through the list to find their choice.  Each time the selection is changed the FieldChangedListener is called but I only want to take action when the final selection is made ("clicked").  I have been searching and searching but haven't found the key to understanding the current state of the ObjectChoiceField (open or closed).  Any help would be greatly appreciated.

 

TIA,

 

Tim

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: ObjectChoiceField and FieldChangeListener

You won't be able to differentiate between these types of changes within a FieldChangeListener.  Instead, you could have the user select an entry and use a ButtonField or MenuItem to verify their choice.  Or you could have your action take place when focus is moved off of the ObjectChoiceField.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 2
Registered: ‎08-25-2009
My Device: Storm 9530 v4.7.0.148

Re: ObjectChoiceField and FieldChangeListener

Thanks for your prompt reply.  I was beginning to suspect that this was the case and was mentally preparing to move on by adding a button.  Thanks!

 

Tim

Highlighted
New Developer
Posts: 14
Registered: ‎08-13-2008
My Device: Not Specified

Re: ObjectChoiceField and FieldChangeListener

The other thing you can do is cache the current selected index of the ObjectChoice field. The selected index does not change until the user actually selects it. So you can tell when a choice has actually been made when the selected index differs than that of the cached selected index.

Regular Contributor
Posts: 70
Registered: ‎06-15-2011
My Device: Bold 9900
My Carrier: Bell Canada

Re: ObjectChoiceField and FieldChangeListener

@rmb177 thank you! that is a great alternative

Contributor
Posts: 23
Registered: ‎01-30-2011
My Device: Not Specified

Re: ObjectChoiceField and FieldChangeListener

What about overriding the objectchoicefield's fieldChangeNotify method?