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
nithyam
Posts: 60
Registered: ‎12-08-2008
My Device: Not Specified

object choice field text

Hi All,

 

i am creating ObjectChoiceField in my applications with list of data. when i use small font size i can view the full texts in that list. if i increase font size , i can view only half of the text

 

how can i solve this problem?

 

 

 

 

regards,

nithya.m

Please use plain text.
Developer
simon_hain
Posts: 16,134
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: object choice field text

you could use two lines. or use DrawStyle.ELLIPSIS to get '...' at the end and provide a detail view. Or a tooltip with the full text on focus.
----------------------------------------------------------
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
Please use plain text.
New Developer
nithyam
Posts: 60
Registered: ‎12-08-2008
My Device: Not Specified

Re: object choice field text

[ Edited ]

How do i use tooltip in ObjectChoiceField? can you provide some sample codes?

 

Regards,

Nithya

Message Edited by nithyam on 10-14-2009 12:33 AM
Please use plain text.
Developer
Blanc
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: object choice field text

Try to increase the width of the  ObjectChoiceField. Create your own OCF in that overwrite the sublayout method and set the width as you want.

 

the following code consists of the constructor and sublayout method of my MYOCF, hope it is useful to you also

public MyObjectChoiceField(String str,String []curr, int startindex, int width) { super(str, curr, startindex, ObjectChoiceField.FIELD_LEFT | ObjectChoiceField.USE_ALL_WIDTH); this.width = width; Font font = this.getFont().derive(Font.EMBOSSED_EFFECT | Font.BOLD, 14); this.setFont(font); } protected void layout(int width, int height) { setExtent(this.width, 50); }

 


 

Thanks and Regards,
PraveenGoparaju.
Please use plain text.
Developer
peter_strange
Posts: 19,604
Registered: ‎07-14-2008
My Device: Not Specified

Re: object choice field text

I think Simon was answering this question for an ObjectListField, rather than an ObjectChoiceField.  And I don't think Blancs answer will help because I'm guessing your Field is using the Full Width of the Screen already and I don't believe that ObjectChoiceField will display two lines for a single object choice.

 

If you really do have a long line to display, then I think you are either going to have to create your own ObjectChoiceField (which will be extremely difficult) or use a ListField - in which case you can do what Simon suggests.

 

But can we confirm that your problem is an ObjectChoiceField (pull down list) with each choice taking the whole width of the screen?

Please use plain text.
New Developer
nithyam
Posts: 60
Registered: ‎12-08-2008
My Device: Not Specified

Re: object choice field text

Yes . we are using object choice field only.Already occupying the whole width of hte screen.

here i can use only objectchoice filed because  when i select item i need to enter some value in same screen. 

 

Please use plain text.
Developer
peter_strange
Posts: 19,604
Registered: ‎07-14-2008
My Device: Not Specified

Re: object choice field text

In that case, I think you will have to try to extend ObjectChoiceField, which I think will be difficult, or create a new Field. 

 

As an example of a new Field, we had a similar issue, solved using something like the following:

 

a) have a RichTextField on the Screen that displays the currently selected value, this is 'clickable', but read only.

b) when the user clicks on this Field, we popup the list of options, using a PopupScreen.  This list is actually a ListField, the user scrolls through this and selects one or escapes.

c) if the user selects an entry, that entry is placed in the clickable RichTextField field on the screen.

 

I'm sure you can think of other variations around similar themes. 

 

Hope this helps.

Please use plain text.