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
Highlighted
New Contributor
Posts: 2
Registered: ‎02-04-2011
My Device: Torch
My Carrier: Programmer
Accepted Solution

Use Both Vertical and Horizontal Scroll

hi everyone, i'm new in BB. i tried to make a manager can scroll both vertical and horizontal. i want make a manager that only containt one BitmapField, where this BitmapField have width and height more than the display, and the manager could scroll both vertical and horizontal so i cant view BitmapField.

 

i have read and try to make something like this ( http://supportforums.blackberry.com/t5/Java-Development/How-to-make-Vertical-and-Horizontal-scroll-o... ) and this one ( http://208.74.204.192/t5/Java-Development/How-can-i-use-both-of-horizontal-scroll-and-vertical-scrol... ) but it doesn't work

 

in generally i want make something like ZoomScreen (i do not use zoomscreen because i can't add button or another field to this thing).

 

i try this one too, but nothing..

 

//BEGIN

 

public myScreen(){

 

VerticalFieldManager _image=new VerticalFieldManager(Manager.VERTICAL_SCROLL|Manager.HORIZONTAL_SCROLL){
        protected void moveFocus(int x, int y, int status, int time) {
            setVerticalScroll(y);
            setHorizontalScroll(x);
            super.moveFocus(x, y, status, time);
        }; 
    };

 

        Bitmap b=Bitmap.getBitmapResource("img/edit.jpg");
        BitmapField bi=new BitmapField(b,BitmapField.USE_ALL_WIDTH);

        _image.add(bi);
        add(_image);

}

 

 

//END

 

thank for answer...and sorry about my bad english (Not My Mom Language ;-D )

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

Re: Use Both Vertical and Horizontal Scroll

Welcome to the forums!

 

First of all, remove USE_ALL_WIDTH from your BitmapField constructor - as is, it will become monstrously huge (a width of Integer.MAX_VALUE >> 1). A default constructor is sufficient. You might have to add FOCUSABLE style depending on your needs.

 

Second, your moveFocus method is quite useless because this one is called only on touchscreen devices when a user touches that particular spot. But touchscreen already allows you to achieve move-scrolling and swipe-scrolling, so your problems is automatically solved there. Besides, moveFocus is a relatively high-level call - all such calls work well on a screen with a lot of focusable fields and other stuff.

 

You will need to override navigationMovement either for the BitmapField if it is FOCUSABLE or for the screen itself. If you want other fields on the screen, this task becomes really non-trivial, so formalize the specs for this screen as much as you can before implementing it. When you have an exact plan, write here if you still need help.

 

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!