Horizontal and Vertical scroll not work for bitmapfield in blackberry application

631 views Asked by At

I have one BitmapField that display image into screen. BitmapField is added into VerticalFieldManager and finally this manager is added to mainscreen.
porblem is that if my image is larger than screen size than i have not able scroll image horizontally or vertically.
My code is below :-

    VerticalFieldManager ver = new   VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL|VerticalFieldManager.VERTICAL_SCROLLBAR|VerticalFieldManager.HORIZONTAL_SCROLL|VerticalFieldManager.HORIZONTAL_SCROLLBAR);
    Bitmap enc_img = Bitmap.getBitmapResource("4.png");

    btm_fld = new BitmapField(enc_img);

    ver.add(btm_fld); 
    add(ver);  

What i am doing wrong here.
thanks in advanced.

1

There are 1 answers

2
Rupak On BEST ANSWER

Following code may help you to get the VerticalFieldManager scrollable:

long style = VERTICAL_SCROLL | VERTICAL_SCROLLBAR | 
    HORIZONTAL_SCROLL | HORIZONTAL_SCROLLBAR;

VerticalFieldManager vfm = new VerticalFieldManager(style);
HorizontalFieldManager hfm = new HorizontalFieldManager();

Bitmap enc_img = Bitmap.getBitmapResource("4.png");
BitmapField btm_fld = new BitmapField(enc_img);

hfm.add(new NullField(NullField.FOCUSABLE));
hfm.add(btm_fld);
hfm.add(new NullField(NullField.FOCUSABLE));

vfm.add(new NullField(NullField.FOCUSABLE));
vfm.add(hfm);
vfm.add(new NullField(NullField.FOCUSABLE));

add(vfm);


But the BitmapField itself will not be scrollable.

Link to an article in Blackberry Development Knowledge Base, Create a scrollable image field.