Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
Normie
Posts: 31
Registered: 02-09-2010
My Carrier: telus

manager problem

In the code below can someone tell me what I have missed that is making the redline below "mainScreen"

 

public xxxxxxxxScreen(){

Manager bitmapScroller = new BitmapScroller();
mainScreen.add(bitmapScroller);


VerticalFieldManager manager = (VerticalFieldManager)getMainManager();
manager.setBackground(BackgroundFactory.createSoli dBackground(Color.ALICEBLUE));
add(new LabelField("XXXXXXXX",Field.FIELD_HCENTER));


Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: manager problem

What is mainScreen?

Please use plain text.
Contributor
Normie
Posts: 31
Registered: 02-09-2010
My Carrier: telus

Re: manager problem

Peter,

Thanks for your reply

I want to use a large Bitmap and have the ability to scroll through the entire bitmap , as I have it now it skips the middle part of the bitmap

I have built what I think is a manager and I am trying to pull it to another screen

Here is the manager

mport net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

	public class BitmapScroller extends VerticalFieldManager{
		private BitmapField bitmapField;
	     

		public BitmapScroller(){
			super(VERTICAL_SCROLL | HORIZONTAL_SCROLL);
			bitmapField = new BitmapField(Bitmap.getBitmapResource("File1-Test83DL.png"), FOCUSABLE);
			add(bitmapField);
		}

		protected boolean navigationMovement(int dx, int dy, int status, int time) {
			if (dx > 0) setHorizontalScroll(getHorizontalScroll() + 5);
			if (dx < 0) setHorizontalScroll(getHorizontalScroll() - 5);
			if (dy > 0) setVerticalScroll(getVerticalScroll() + 5);
			if (dy < 0) setVerticalScroll(getVerticalScroll() - 5);
			return true;
		}

 

I want to have this on my "xxxxxxxxScreen"

 

Cheers!! 

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: manager problem

Does this help?

 

How To - Create a scrollable image field
Article Number: DB-00681
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...

Please use plain text.
Contributor
Normie
Posts: 31
Registered: 02-09-2010
My Carrier: telus

Re: manager problem

Thanks Peter,

That was exactly the help I needed

Now I will spend 3 or 4 days to try and get it to scroll with a button at the bottom of the screen,

Any documents you can point me at ?

 

Thanks again

Cheers!!!

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: manager problem

MainScreen has a status area at the bottom (setStatus(..)).  If you add your button in there, it will always be at the bottom of the screen.

 

Does that help?

Please use plain text.
Contributor
Normie
Posts: 31
Registered: 02-09-2010
My Carrier: telus

Re: manager problem

I'm not quite sure where to add "(setStatus(..))." here is my code :

 

bitmapScroller = new BitmapScroller(logoBitmap);
	add(bitmapScroller);
	bitmapScroller.setChangeListener(this);{
	}
	
	storeButton = new ButtonField("FIND a STORE", ButtonField.CONSUME_CLICK);
    storeButton.setChangeListener(this);
    findButton = new ButtonField("FIND a BOTTLE", ButtonField.CONSUME_CLICK );
    findButton.setChangeListener(this);
    
    HorizontalFieldManager buttonManager = new HorizontalFieldManager(Field.FIELD_HCENTER);
    buttonManager.add(storeButton);
    buttonManager.add(findButton);
    add(buttonManager);
	}

 

Cheers!!!

Please use plain text.
Developer
zany
Posts: 222
Registered: 11-11-2009

Re: manager problem

instead of adding the manager (buttonManager) to the screen, set it in the status like in the following code below so that your buttons (store and find) will be displayed at the bottom of the screen always

 

bitmapScroller = new BitmapScroller(logoBitmap);
add(bitmapScroller);
bitmapScroller.setChangeListener(this);{
}

storeButton = new ButtonField("FIND a STORE", ButtonField.CONSUME_CLICK);
storeButton.setChangeListener(this);
findButton = new ButtonField("FIND a BOTTLE", ButtonField.CONSUME_CLICK );
findButton.setChangeListener(this);

HorizontalFieldManager buttonManager = new HorizontalFieldManager(Field.FIELD_HCENTER);
buttonManager.add(storeButton);
buttonManager.add(findButton);
add(buttonManager);
setStatus (buttonManager);
}
with regards,
Vignesh J

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Don't forget to mark your post as solved if you get the answer and dont forget to give kudos if the answer is useful for you.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Please use plain text.
Contributor
Normie
Posts: 31
Registered: 02-09-2010
My Carrier: telus

Re: manager problem

Thanks for the reply..

When I add the buttons the bitmap will not scroll completely like it will without the buttons

Thats the problem I am having

 

Cheers

Please use plain text.
Developer
zany
Posts: 222
Registered: 11-11-2009

Re: manager problem

"When I add the buttons the bitmap will not scroll completely like it will without the buttons"

are you not able to scroll down till to the end (ie., bottom/right)  to see image?

with regards,
Vignesh J

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Don't forget to mark your post as solved if you get the answer and dont forget to give kudos if the answer is useful for you.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Please use plain text.