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

Posts: 69
Registered: ‎08-25-2008
My Device: Not Specified

How to add ButtonField to HorizontalManager?



Iam new to this domain, I am adding Textfield with label and ButtonField to HorizontalFieldManager but iam unable to get Button in Simulator,and if i add this to MainScreen object i can visible the button.  And how to add rectangle shape to TextField.


Advanced thanks for any help.




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

Re: How to add ButtonField to HorizontalManager?

Fields need to be added to a manager, not another field.  You can add it to MainScreen because MainScreen contains a built in VerticalFieldManager.
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
Posts: 25
Registered: ‎09-08-2008
My Device: Not Specified

Re: How to add ButtonField to HorizontalManager?

[ Edited ]

I Also having same problem now I got that Thanks Msohm.

Message Edited by gsk_56 on 11-12-2008 01:53 AM
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to add ButtonField to HorizontalManager?

the problem here seems that the textfield has an unlimited witdth (16mio+) which denies the horizontalfieldmanager a layout where the buttonfield is visible (the manager adds the buttonfield but it is 16+mio pixels to the right).

there are several solutions, all not very beginner-friendly i guess:
- overwrite the width-methods of the textfield to have a fixed witdth
- use a fixed layout manager to place the buttonfield on a certail position

limiting the textfield to a certain number of characters (setMaxSize()) does not solve the problem in this context.
if you change the width or put the button to a fixed location it is advised to set the maximum textsize accordingly (or extend the textfield to handle this).
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