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
Highlighted
New Developer
Posts: 14
Registered: ‎09-12-2009
My Device: Not Specified

Drop down list box

I am new to the blackerry development. I need to display a drop down list box of items. I have used "ObjectChoiceField" for this. Following is the code:

 

 

String [] choices = {"Option one", "Option two", "Option three"};
ObjectChoiceField o = new ObjectChoiceField("",choices,0,ObjectChoiceField.FIELD_HCENTER);

 

But, when this component appears, there is no conventional "down arrow" to indicate that it is a pull down menu. Can somebody, please guide so as to how should I have a pull down menu displayed.

 

The code works in the emulator, and using the space bar, I can even change the selected option from the list. But, as mentioned, this does not appear as a conventional pull down, so that the user understands that he would be able to select from this component.

Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: Drop down list box

BlackBerry user experience is same as objectchoicefield is behaving. If you are thinking from BB suer prespective, you can go with objectchoicefield; you need not to worry about it as BB user is having same experience.

 

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution"

 

Deepesh Gupta
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Drop down list box

Just to confirm what Deepesh is saying, BlackBerry users will recognize the Drop Down List.  There is no Standard UI component that will give you a visual indicator that the drop download is a drop down list, except on the Storm, which does it automatically for the ObjectChoiceField among others.  You can create your own version of the Field if you wish to give a visual clue.
New Developer
Posts: 39
Registered: ‎10-13-2009
My Device: Not Specified

Re: Drop down list box

My problem is in the same context though it is opposite. I'm displaying 3 ObjectChoiceField objects in a screen placed inside a HorizontalFieldManager. On all devices screen shows fine. But in case of Storm 2 whose screen is a bit less wide the screen throws up Illegal Argument Exception as it is unable to provide width to the 3 objects and paint them successfully. To solve this problem I used Display.getWidth() to get the screen width and gave relative widths to the 3 objects. In this width tradeoff I was able to get away with Runtime Exception and the objects paint successfully but I'm unable to put the some necessary characters in the 1st ObjectChoiceField's label. If I add them then due to width increase the UI distorts on Storm 2 - 1st ObjectChoiceField shifts to bottom and all 3 do not align in one row So one way out that I thought was to remove the drop-down arrays from ObjectChoiceFields. This way all labels can be accomodated.

I want to know How I remove the arrays?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Drop down list box

I presume you mean the choice arrays.  But if you remove these, what choices will be displayed?

 

If I have not understood clearly, can you explain again please.

New Developer
Posts: 39
Registered: ‎10-13-2009
My Device: Not Specified

Re: Drop down list box

Peter Please see the first  .png attached. I want to remove the arrow so that I get lesser width per ObjectChoiceField and  I'm able to algin them successfully in one row with required data. In fact If I can get ObjectChoiceField like it used to be in Bold device (plz see 2nd .png attached) then that will solve it for sure.

 

1st .png

first.PNG

 

 

 

 

 

 

 

 

2nd .png

 

second.PNG

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Drop down list box

Can't see pictures in either Firefox or IE

New Developer
Posts: 39
Registered: ‎10-13-2009
My Device: Not Specified

Re: Drop down list box

oh. I'll explain you -

The ObjectChoiceField in Storm 2 shows default border and an drop-down arrow. I want to remove the drop-down arrow so that the ObjectChoiceField's width reduces and I get extra space that solves my problem.

ObjectChoiceField does not show this arrow in Bold and other earlier devices

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Drop down list box

I am not aware of a way to do this.

New Developer
Posts: 96
Registered: ‎07-26-2008
My Device: Not Specified

Re: Drop down list box

4.7.1 and higher also insert a drop down arrow automatically, so if you had designed your drop down with your own image/visual cue  in code that you intended to work across multiple versions ( say 4.6 and higher)  - you will end up with 2 visual cues ( one native down arrow from BlackBerry and one from your own code).  Since there is no way to avoid the native drop down, you will have to write conditional code based on the device OS version, and in some cases the hardware version  to not display your own.