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
New Developer
ScottVickery
Posts: 32
Registered: ‎10-27-2009
My Device: Not Specified

Storm: ObjectListField + HORIZONTAL_SCROLL = IllegalArgumentException in Bitmap

The following code throw an IllegalArgumentException in Bitmap.  I can provide a stack trace if needed. 

 

If I take the Manager.HORIZONTAL_SCROLL out, the screen loads just fine.  I would like to have a horizontal scrollbar.  Any idea why this happens?  Any known work around?

 

 

class TstScreen extends MainScreen
{
public TstScreen()
{
super(Manager.HORIZONTAL_SCROLL);
ObjectListField list = new ObjectListField();
String[] items = new String[3];

items[0] = "item 1";
items[1] = "item 2";
items[2] = "item 3";
list.set(items);

add(list);
}
}

public class HelloWorld extends UiApplication
{
public static void main(String[] args) throws Exception
{
HelloWorld theApp = new HelloWorld();
theApp.enterEventDispatcher();
}

public HelloWorld() throws Exception
{

TstScreen scr = new TstScreen();
Ui.getUiEngine().pushScreen(scr);
}
}


 

 

Thanks,

Scott

Please use plain text.
Developer
editormax
Posts: 133
Registered: ‎07-20-2009
My Device: Not Specified

Re: Storm: ObjectListField + HORIZONTAL_SCROLL = IllegalArgumentException in Bitmap

HORIZONTAL_SCROLLBAR

public static final long HORIZONTAL_SCROLLBAR

Manager style to turn on horizontal scrollbars.

Note: this functionality has been implemented only for scroll arrows.

 

 

so If you need a HORIZONTAL_SCROLLBAR, you need to implements yourselves

Please use plain text.
New Developer
ScottVickery
Posts: 32
Registered: ‎10-27-2009
My Device: Not Specified

Re: Storm: ObjectListField + HORIZONTAL_SCROLL = IllegalArgumentException in Bitmap

Adding HORIZONTAL_SCROLLBAR makes no difference.  I don't really care if I have a scroll bar, but, I need the screen to be scrollable.

 

super(Manager.HORIZONTAL_SCROLL | Manager.HORIZONTAL_SCROLLBAR);

 

The problem is the ObjectListField on the screen combined with horizontal scolling.  If, for example, I use a LabelField, horizontal scrolling works just fine.  I can give a code example here if needed.

 

My situation is more complicated than this.  I have a custom ListField class.  I have boiled this down the minimal example.

 

Thanks,

Scott

Please use plain text.
Developer
editormax
Posts: 133
Registered: ‎07-20-2009
My Device: Not Specified

Re: Storm: ObjectListField + HORIZONTAL_SCROLL = IllegalArgumentException in Bitmap

Did you try to add a HorizontalFieldManager which is set  HORIZONTAL_SCROLL on the screen first, and then add you list field into the HorizontalFIeldManager.

Please use plain text.
New Developer
ScottVickery
Posts: 32
Registered: ‎10-27-2009
My Device: Not Specified

Re: Storm: ObjectListField + HORIZONTAL_SCROLL = IllegalArgumentException in Bitmap

I have tried many different approaches.  For giggles, tried what you suggested.  No luck.  Following is the code.  Take the Manager.HORIZONTAL_SCROLL out, the bomb goes away, but, no scrolling.

 

class TstScreen extends MainScreen
{
public TstScreen()
{
	super();
	
	HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);
	ObjectListField list = new ObjectListField();
	String[] items = new String[3];
	
	items[0] = "item 1 item 1 item 1 item 1 item 1 item 1 item 1 item 1 item 1 ";
	items[1] = "item 2";
	items[2] = "item 3";
	list.set(items);
	
	hfm.add(list);

	add(hfm);				
}
}

 

Please use plain text.
New Developer
ScottVickery
Posts: 32
Registered: ‎10-27-2009
My Device: Not Specified

Re: Storm: ObjectListField + HORIZONTAL_SCROLL = IllegalArgumentException in Bitmap

Other ideas?

 

Scott

Please use plain text.