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
Developer
Posts: 27
Registered: ‎07-17-2008
My Device: Not Specified
Accepted Solution

Customised VerticalFieldManagers

I’m trying to create a UI similar to the new 9000 style UI (example below). 

 

 

I am using a customised VerticalFieldManager for the outer grey area and a second customised VerticalFieldManager for the inner white boxes.  I am using the new BorderFactory class to try and imitate the rounded corners.  In order to create the padding between the edge of the screen and the inner boxes I am overriding the sublayout method on the outer VerticalFieldManager.

 

 This code produces the result shown below with the bottom border visible  

protected void sublayout(int iWidth, int iHeight)
{
    super.sublayout(iWidth, iHeight);        

    setExtent(iWidth, iHeight);
} 

 

However, in order to add the padding I need to position the inner VerticalFieldManagers myself.  The code below shows what I think should be happening (without the extra padding), but it doesn’t give me the expected result – i.e. the bottom border is not visible (see image below).    

protected void sublayout(int iWidth, int iHeight)
{
    int iNumFields = getFieldCount();
    int iYPos = 0; 

    for (int i = 0; i < iNumFields; i++)
    {
        Field fField = this.getField(i);

        setPositionChild(fField, 0, iYPos);
        layoutChild(fField, iWidth, iHeight);

        iYPos = iYPos + fField.getHeight();
    }

    setExtent(iWidth, iHeight);
}

 

I have exhausted the forums and Googled this issue to death.  Any ideas what I am doing wrong here?

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

Re: Customised VerticalFieldManagers

Please have a look at the decordemo sample application included with the version 4.6.0 BlackBerry JDE for an example on the use of the Border class and decor APIs.
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
Developer
Posts: 27
Registered: ‎07-17-2008
My Device: Not Specified

Re: Customised VerticalFieldManagers

I'm sorry, but I'm not sure how this helps me.  The DecorDemo sample does not contain any code to manually lay out any fields or managers and it is the layout of my inner VerticalFieldManagers that I am having problems with rather than the drawing of the borders.

 

I think the problem lies with the sublayout method from my earlier post, but I can't figure out what I need to do to allow the bottom border to scroll into view (oh, and the outer VerticalFieldManager is set to scroll so that is not where the problem lies either).

 

Regards,

 

Joanna

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

Re: Customised VerticalFieldManagers

Sorry about that, I wasn't able to view your second image so I thought it was a border issue.  Can you verify the link so I can see what you have?
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
Developer
Posts: 27
Registered: ‎07-17-2008
My Device: Not Specified

Re: Customised VerticalFieldManagers

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

Re: Customised VerticalFieldManagers

Thanks, I was able to see the images.  I see the obvious change between the images where the border is not shown, but I'm not noticing any other changes.  Where are you trying to add the padding?  Are you trying to make the border at the bottom of the screen larger?  Or are you trying to add padding somewhere else?
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
Developer
Posts: 27
Registered: ‎07-17-2008
My Device: Not Specified

Re: Customised VerticalFieldManagers

Sorry, I was trying to make my example simple by removing the padding so you could see the difference between my sublayout method and the one where I just called super.sublayout().

 

Anyway, here is the code for the outer VerticalFieldManager which includes the code for the padding.  I have taken a screenshot of a screen with padding below (URL is http://img33.picoodle.com/data/img33/3/9/25/f_bank3m_9def4ff.png in case you can't see this one).

 

public class OuterDetailFieldManager extends VerticalFieldManager { final static int PADDING_HORIZONTAL = 6; final static int PADDING_VERTICAL = 3; public OuterDetailFieldManager() { super(OuterDetailFieldManager.USE_ALL_WIDTH | OuterDetailFieldManager.VERTICAL_SCROLL); this.setBackground(BackgroundFactory.createSolidBackground(Color.PURPLE)); } public void sublayout(int iWidth, int iHeight) { int iNumFields = getFieldCount(); int iYPos = PADDING_VERTICAL; for (int i = 0; i < iNumFields; i++) { Field fField = this.getField(i); setPositionChild(fField, PADDING_HORIZONTAL, iYPos); layoutChild(fField, iWidth - (2 * PADDING_HORIZONTAL), Integer.MAX_VALUE); iYPos = iYPos + fField.getHeight() + PADDING_VERTICAL; } this.setExtent(iWidth, iHeight); } }

Developer
Posts: 27
Registered: ‎07-17-2008
My Device: Not Specified

Re: Customised VerticalFieldManagers

Has anybody got any ideas how I make the bottom border appear?

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

Re: Customised VerticalFieldManagers

From the screen shot, it looks like the border is shown on the bottom.  There is a border all the way around your manager with a white background.  Or are you looking for a border somewhere else?  Can you draw on one of your images where you are trying to make a border appear?
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
Developer
Posts: 27
Registered: ‎07-17-2008
My Device: Not Specified

Re: Customised VerticalFieldManagers

Ok, here is the image of the screen when I don't override the sublayout method.

 

Here is the image where I do override the sublayout method in order to add the padding.  There is a distinct lack of a border at the bottom of the inner VerticalFieldManager (the one with the white background).  This only occurs when the Vertical Field Manager contains so many text fields that you need to scroll to bring them into view.  If there are only a couple of fields then you can see the border as per the image in my last post.

 

Does this help you understand my problem?