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

New Contributor
Posts: 3
Registered: ‎04-20-2010
My Device: n/a
My Carrier: n/a

Only one custom fieldmanager shows when adding multiple

Hi Guys,


I implemented this custom fieldmanager:


public class CustomHorizontalFieldManager extends Manager {
    public CustomHorizontalFieldManager(){

    protected void sublayout(int width, int height) {
        Field field;
        //get total number of fields within this manager
        int numberOfFields = getFieldCount();
        int x = 0;
        int y = 0;
        for (int i = 0;i < numberOfFields;i++) {
            field = getField(i); //get the field
            setPositionChild(field,x,y); //set the position for the field
            layoutChild(field, width, height); //lay out the field
            x += 70; //add a gap of 70 pixels between the adjacent fields
        setExtent(width, height);

    public int getPreferredHeight() { 
        return 30;

    public int getPreferredWidth() {      
        return this.getFieldCount()*70;


When I add several instences of this fieldmanager to a VerticalFieldManager in my mainscreen, only the fields from the first custom fieldmanager are shown:


CustomHorizontalFieldManager chfm1 = new CustomHorizontalFieldManager();

CustomHorizontalFieldManager chfm2 = new CustomHorizontalFieldManager();

CustomHorizontalFieldManager chfm3 = new CustomHorizontalFieldManager();

VerticalFieldManager vfm = new VerticalFieldManager(VerticalFieldManager.HORIZONTAL_SCROLL);




chfm1.add(new RichTextField("Firstname1",RichTextField.USE_TEXT_WIDTH ));

chfm1.add(new RichTextField("Lastname1",RichTextField.USE_TEXT_WIDTH ));

chfm2.add(new RichTextField("Firstname2",RichTextField.USE_TEXT_WIDTH ));

chfm2.add(new RichTextField("Lastname2",RichTextField.USE_TEXT_WIDTH ));

chfm3.add(new RichTextField("Firstname3",RichTextField.USE_TEXT_WIDTH ));

chfm3.add(new RichTextField("Lastname3",RichTextField.USE_TEXT_WIDTH ));



I can only see: Firstname1              Lastname1


Thank you in advance for your reply.







New Contributor
Posts: 3
Registered: ‎04-20-2010
My Device: n/a
My Carrier: n/a

Re: Only one custom fieldmanager shows when adding multiple