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: 51
Registered: ‎09-18-2008
My Device: Not Specified

I need to put a scrollbar image in b/w scrolling arrow ..

Hi

 

I am having this below code.I am able scroll with two up and down arrow without scrollbar in the middle. I need to put scrollbar in between this to arrow where scrolling scrollbar can appear on the screen. If you send a code it will be helpful for me..Pls help me

 

 

VerticalFieldManager vfm = new VerticalFieldManager(
                Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR) {
            //|INCREMENTAL_LAYOUT
            int maxHeight = this.getFont().getHeight() * 3;

            public int getPreferredHeight() {
                return this.getFont().getHeight() * this.getFieldCount();
            }

            protected void sublayout(int width, int height) {
                super.sublayout(width, height);
                setExtent(width, Math.min(maxHeight, this.getPreferredHeight()));
            }
        };

 

 

Thanks in advance.

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

Re: I need to put a scrollbar image in b/w scrolling arrow ..

The active theme on the BlackBerry controls how scrollbars and scroll arrows appear.  With the exception of drawing the scrollbar/arrows yourself and handling scrolling, there are no APIs to modify this.
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: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: I need to put a scrollbar image in b/w scrolling arrow ..

Mark,

 

What the code naveensh has supplied attempts to do, is support is a restricted height VerticalFieldManager, which only takes up part of the screen (see maxHeight).  However, 4 or more CheckboxFields get added to it, so getPreferredHeight() indicates a taller screen that the sublayout allows.  The manager has been created with a Style that suggests it should display scroll bars, but even in these circumstances, it doesn't.. However it does scroll vertically, so the user can see all the CheckboxFields, the user just gets no visible indication that there are more to scroll to. 

 

How can we change this so that the user does see the Scroll bars, as they would if, say, 11 CheckboxFields were added to a MainScreen.

 

Tested on JDE 2.4.1 and associated Sim.

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

Re: I need to put a scrollbar image in b/w scrolling arrow ..

Sorry, I misinterpreted this one.  Scrollbars should automatically appear when a manger is scrollable.  I have reported this issue to our development team.
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
New Developer
Posts: 5
Registered: ‎11-14-2008
My Device: Not Specified

Re: I need to put a scrollbar image in b/w scrolling arrow ..

The following code is my testing code for custom layout manager, just trying to have first half screen scrollable and 2nd half non-scrollable.  The first haf screen works, however, I don't see the upward scroll arrow and downward scroll arrow on the right side of screen.   How could I fix it so that I have half-screen scrollable with upward and downward arrow on right side?

 

Can anybody help me and post some sample codes?

 

Thank you very much.

 

Scott

 

 

/*
 * Napolean.java
 *
 * © <your company here>, 2003-2008
 * Confidential and proprietary.
 */

package com.source;

import net.rim.device.api.ui.UiApplication;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;

 



 
class Napolean extends UiApplication {
   
   
    public static void main (String[] args)
    {
       
    Napolean theApp =new Napolean();
    theApp.enterEventDispatcher();
       
    }
   
   
    public Napolean()
    {
       
        pushScreen(new NP_RegisterScreen2());
       
    }
}





class NP_RegisterScreen2 extends MainScreen {
   
 
    NP_RegisterScreen2()
    {
         CustomManager_test Layout_test = new CustomManager_test(120);
           add(Layout_test);
          
            for (int i=0; i<10; i++)  {
                     ButtonField  btn =  new ButtonField( "test"+i);
   
                      Layout_test.add(btn);
        }
          
    }
}


 
    class CustomManager_test extends VerticalFieldManager
    {
        int _managerHeight; // Total height of the manager
        int screen_width= Graphics.getScreenWidth();
        // Pass in desired height.  Scrolling is turned off in both directions.
        public CustomManager_test(int passHeight)
        {
            super( Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR);
           
            _managerHeight = passHeight;
        }  
 
        // Sublayout is called automatically to position all the internal fields to this
        // layout.  Its sublayouts job to read in the custom coordinates of each of the fields
        // and place them accordingly.
        protected void sublayout(int width, int height)
        {
             Field field;
            int numberoofFields =getFieldCount();
          
           
           
            int x=0;
            int y=0;
            for (int lcv = 0; lcv < numberoofFields; lcv++)
            {
                field = getField(lcv);
                setPositionChild(field, x, y);
                 layoutChild(field, width , height);
            x=0;
            y+=30;
               
            }
            
            //Set the manager's dimensions
            setExtent(width, _managerHeight);
        }
 
        public int getPreferredWidth()
        {
            return Graphics.getScreenWidth();
        }
 
        public int getPreferredHeight()
        {
//            return Graphics.getScreenHeight();

return 60;              


        }
    }