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
Regular Contributor
Posts: 88
Registered: ‎04-09-2010
My Device: 9530
My Carrier: Software Developer

Scrolling CheckBoxField

Hello EveryOne

 

I am using following code to display checkboxfield on a popup Screen, when i am adding more then 7 checkboxfield then illegalstateException is coming, if i am adding more then 7 buttonfield then no error is coming and they are scrolling, i dont no what the problem is, please help me out

 

 

public CustomDialog(DisplayScreen obj) {
		super(new VerticalFieldManager(NO_HORIZONTAL_SCROLL | NO_VERTICAL_SCROLL), Screen.DEFAULT_CLOSE);
		try {
			FontFamily alphaSerifFamily = FontFamily.forName("BBAlpha Serif"); 
			appFont = alphaSerifFamily.getFont(Font.PLAIN,9,Ui.UNITS_pt);
			alphaSerifFamily.getFont(Font.PLAIN,7,Ui.UNITS_pt);
		} catch(ClassNotFoundException e) {
			Dialog.alert("Font Error");
		}
		this.obj = obj;
		vManager=new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL
											| VerticalFieldManager.VERTICAL_SCROLLBAR 
												| VerticalFieldManager.FIELD_HCENTER);

		recruting = new CheckboxField("Recruiting",false);
		noRecruting = new CheckboxField("Not yet Recruiting",false);
		avilable = new CheckboxField("Avilable",false);
		completed = new CheckboxField("Completed",false);
		active = new CheckboxField("Active, not Recruting",false);
		approved = new CheckboxField("Approved for Marketing",false);
		enrolling = new CheckboxField("Enrolling by invitation",false);
		nolonger = new CheckboxField("No Longer Avilable",false);
		temprarily = new CheckboxField("Temporarily not Avilable",false);
		terminated = new CheckboxField("Terminated",false);
		withdraw = new CheckboxField("Withdraw",false);
		withheld = new CheckboxField("Withheld",false);

		vManager.add(recruting);
		vManager.add(noRecruting);
		vManager.add(avilable);
		vManager.add(completed);
		vManager.add(active);
		vManager.add(approved);
		vManager.add(enrolling);
		vManager.add(noRecruting);
		vManager.add(nolonger);
		vManager.add(temprarily);
		vManager.add(terminated);
		vManager.add(withdraw);
		vManager.add(withheld);
		vManager.setFont(appFont);

		doneImage = Bitmap.getBitmapResource("done.png");
		cancelImage = Bitmap.getBitmapResource("cancel.png");
		int wt = doneImage.getWidth() + 3;
		int ht = doneImage.getHeight() + 3;
		done = new CustomSmallButton(GlobalData.getScaledBitmapImage("done.png",wt, ht),doneImage, 0);
		done.setChangeListener(this);
		cancel = new CustomSmallButton(GlobalData.getScaledBitmapImage("cancel.png", wt, ht), cancelImage, 0);
		cancel.setChangeListener(this);
		hManager = new HorizontalFieldManager();
		hManager.add(done);
		hManager.add(cancel);
		vManager.add(hManager);
		add(vManager);
	}

	protected void sublayout(int width, int height) {
		layoutDelegate(width - 150, height - 100);
		setPositionDelegate(10,10);
		setExtent(width - 120, Math.min(height, getDelegate().getHeight()+ 10));
		widthDelg = width - 120;
		heightDelg = Math.min(height, getDelegate().getHeight()+ 10);
		setPosition((width - getWidth())/2, (height - getHeight())/2);
	}

	protected void paintBackground(Graphics graphics) {
		graphics.setColor(Color.BLACK);
		graphics.drawRoundRect(0, 0, getWidth(), getHeight(), 12, 12);
		graphics.drawBitmap (0, 0, Display.getWidth(), Display.getHeight(), GlobalData.getScaledBitmapImage("bkgnd.png",widthDelg,heightDelg), 0, 0);
		super.paint (graphics);
	}

 help me out

 

Thanks in advance

 

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

Re: Scrolling CheckBoxField

Can you replace the second line in your code with

super(new VerticalFieldManager(NO_HORIZONTAL_SCROLL | VERTICAL_SCROLL), Screen.DEFAULT_CLOSE);

and see if it changes anything?

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

Re: Scrolling CheckBoxField

> then illegalstateException is coming,

 

Which part of the code throws that Exception ?

 

Your code snippet cannot be compiled directly, if you need help, you'd better post a complete compilable example that reproduces the problem.


-----
A good decision is based on knowledge and not on numbers.
Regular Contributor
Posts: 88
Registered: ‎04-09-2010
My Device: 9530
My Carrier: Software Developer

Re: Scrolling CheckBoxField

When i am using ButtonField , LabelField or EditField it is working perfectly .. scrolling is working perfectly.. is there any problem with checkboxfield

Highlighted
Regular Contributor
Posts: 88
Registered: ‎04-09-2010
My Device: 9530
My Carrier: Software Developer

Re: Scrolling CheckBoxField

[ Edited ]

hey i got the solution for the problem.. actually i was adding noRecruting  checkbox for two times..

m sorry for taking your time