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
Contributor
isra2628
Posts: 14
Registered: ‎10-05-2011
My Device: dont have one
My Carrier: DN
Accepted Solution

list with separators like options

Hello,

I really need help to draw a separators between the list items, and to add icon in the begining.

Im desperate please help

Thanks

 

list.jpg

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: list with separators like options

What have you tried already?

 

Seems to me that if you are using ObjectListField, you have to implement the drawRow anyway, simply paint the bottom line on each row.

 

Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900
My Carrier: Not Specified

Re: list with separators like options

According to your requirement,

 

1. Download the AdvancdUI zip file from below link and extract it;

 

Advance UI Components from GITHUB

 

and take only ListStyleButtonField.java file from it and add to your application;

 

and 

 

take this sample code: SanpleScreen.java

 

public class SampleScreen extends MainScreen implements FieldChangeListener
{	
	ListStyleButtonField listStyleButtonField[];
	Bitmap bitmap=Bitmap.getBitmapResource("icon.png");
	int size=0;
	public SampleScreen() 
	{		
		size=10;	
		createGUI();
	}
	
	private void createGUI() 
	{
		VerticalFieldManager vertical=new VerticalFieldManager(VERTICAL_SCROLL| VERTICAL_SCROLLBAR);
		listStyleButtonField=new ListStyleButtonField[size];
		
		for(int i=0;i<size;i++)
		{
			listStyleButtonField[i]=new ListStyleButtonField(bitmap, "ListField"+(i+1), null, Field.FIELD_VCENTER)//Parameters: leftIcon, label, rightIcon, style;
			{
				protected boolean navigationClick(int status, int time) 
				{
					fieldChangeNotify(0);
					return super.navigationClick(status, time);
				}
			};
			listStyleButtonField[i].setChangeListener(this);			
			vertical.add(listStyleButtonField[i]);
			vertical.add(new SeparatorField(SeparatorField.LINE_HORIZONTAL));
		}
		add(vertical);
	}

	public void fieldChanged(Field field, int context) 
	{
		for(int i=0;i<size;i++)
		{
			if(field==listStyleButtonField[i])
			{
				Dialog.alert("You Clicked on "+(i+1)+"th Field.");
			}
		}
	}
}

 

when I run this I got like this:

 

image1-01.png

 

Try to run this sample; 

 

=====================================================================

Feel free to click LIKE button if the solution is helps you;

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
Contributor
isra2628
Posts: 14
Registered: ‎10-05-2011
My Device: dont have one
My Carrier: DN

Re: list with separators like options

alishaik786 

thank you 10000000000000 times

i really appreciate your help, that exactly what i want 

Please use plain text.