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: 41
Registered: ‎01-02-2010
My Device: Curve 8530
My Carrier: Sprint
Accepted Solution

VerticalField Manager Custom Image Display and Scroll Problem

I have the following code that does a great job of displaying my buttons and text in my 8530.  The problem I am having is that when I view it on a different phone the image does not go all the way to the bottom of the screen (e.g. on a 9550 sim).  When I add the Field.USE_ALL_HEIGHT value the image goes all the way down to the bottom of the screen, however when I scroll down to the Close button I see a lot of white space below the image with the Close button all the way to the top.  I tried creating a non scrollable vert manager with the background image and put the buttons on a second one assigning it to the first with no luck.  How can I get it so there is not any white space below the image? thanks

 

 

///////////////////////////////////////////////////
    // Creates the button and text on the main screen
    VerticalFieldManager vFM = new VerticalFieldManager(Field.USE_ALL_WIDTH |
                                                        VerticalFieldManager.VERTICAL_SCROLL |
                                                        VerticalFieldManager.VERTICAL_SCROLLBAR |)
     {
      //Override the paint method to draw the background image.
      public void paint(Graphics graphics)  
       {
        //Draw the background image and then call super.paint to paint the rest of the screen.
        graphics.drawBitmap(0, 0, Display.getWidth(), Display.getHeight(),bgImage, 0, 0);
        super.paint(graphics);
       }
     };
                           
    LabelField para_1 = new LabelField( "Mark your location and then " +
                                        "generate a route back to that location"
                                       ,LabelField.FIELD_HCENTER);
    LabelField para_2 = new LabelField( "** You will need access to GPS **"
                                       ,LabelField.FIELD_HCENTER);                                  
    vFM.add(para_1);
    Font fnt = this.getFont().derive(Font.BOLD);
    para_1.setFont(fnt);
    vFM.add(para_2);
    vFM.add(viewCurrentLocBTN);
    vFM.add(viewMarkCurrentLocBTN);
    vFM.add(markCurrentLocBTN);   
    vFM.add(routeBackBTN);
    vFM.add(closeAppBTN);
    this.add(vFM);
    ///////////////////////////////////////////////////    
   

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: VerticalField Manager Custom Image Display and Scroll Problem

 

//Override the paint method to draw the background image.
public void paint(Graphics graphics)  
{
  //Draw the background image and then call super.paint to paint the rest of the screen.
  graphics.drawBitmap(getHorizontalScroll(), getVerticalScroll(), bgImage.getWidth(), bgImage.getHeight(), bgImage, 0, 0);
  super.paint(graphics);
}

Red - necessary changes; blue - optional but generally smart.

 

Makes sense?

 

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Contributor
Posts: 11
Registered: ‎03-04-2010
My Device: 9000
My Carrier: vodafone

Re: VerticalField Manager Custom Image Display and Scroll Problem

I usually use USE_ALL_HEIGHT.

 

VerticalFieldManager vFM = new VerticalFieldManager(USE_ALL_WIDTH | USE_ALL_HEIGHT |    VerticalFieldManager.VERTICAL_SCROLL |
                                                        VerticalFieldManager.VERTICAL_SCROLLBAR |)

 

 

Developer
Posts: 41
Registered: ‎01-02-2010
My Device: Curve 8530
My Carrier: Sprint

Re: VerticalField Manager Custom Image Display and Scroll Problem

added the extra code and increased the sixe of my background image.  Now the white does not show below my image but the Close button jerks to the top of the screen if I try to scoll past the button. Is there a setting to tell the screen scrolling to stop at a specific object so that object is at the bottom of the screen?

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: VerticalField Manager Custom Image Display and Scroll Problem

What is the manager (Screen) to which you add this VFM? Is it a MainScreen or its descendant? What else is added to that manager / screen?

If you are using MainScreen, check out this knowledge base article:

MainScreen explained

 

Good luck!

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 41
Registered: ‎01-02-2010
My Device: Curve 8530
My Carrier: Sprint

Re: VerticalField Manager Custom Image Display and Scroll Problem

Thankss!  After reading the reference I figured out all I needed to do was change this

 

super();

 

to this at the beginning of the method that creates the screen

 

super(NO_VERTICAL_SCROLL);