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
Trusted Contributor
Himanshu_berry
Posts: 138
Registered: ‎04-19-2012
My Device: No

Re: Issue of verticalfieldmanager with the LableField

[ Edited ]

Try this code ..just copy and paste

and tell me

 

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.CheckboxField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.SeparatorField;
import net.rim.device.api.ui.container.HorizontalFieldManager;

 

public class myforumans extends UiApplication
{
public static void main(String args[])
{
myforumans ff = new myforumans();
ff.enterEventDispatcher();
}
public myforumans()
{
pushScreen(new scr());
}
}


class scr extends MainScreen
{
public scr()
{
setTitle("MyApp");
LabelField lb = new LabelField("Title",LabelField.FIELD_HCENTER);
add(lb);
add(new SeparatorField());
VerticalFieldManager vfm = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL | VerticalFieldManager.VERTICAL_SCROLLBAR);
LabelField lb2 = new LabelField("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and \n scrambled it to make a type specimen book. It has survived not only five centuries, but \n also the leap into electronic typesetting, remaining essentially unchanged.");
vfm.add(lb2);
vfm.add(new SeparatorField());

add(vfm);

HorizontalFieldManager hfm = new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER);
ButtonField bfm = new ButtonField("Ok");
hfm.add(bfm);
ButtonField bfm2 = new ButtonField("cancel");
hfm.add(bfm2);
add(hfm);
}
}

Please use plain text.
Developer
rabiray
Posts: 141
Registered: ‎07-13-2011
My Device: BB Bold

Re: Issue of verticalfieldmanager with the LableField

Hi,

 

Why not crating your own edit filed....

 

Try to use something like this

http://stackoverflow.com/questions/10444199/vertical-scroll-textfield-in-blackberry

 

Thx

Ray

Please use plain text.
Developer
peter_strange
Posts: 19,608
Registered: ‎07-14-2008
My Device: Not Specified

Re: Issue of verticalfieldmanager with the LableField

And why not take note of what Simon told you over 2 hours ago!

Please use plain text.
Developer
pankajace12
Posts: 206
Registered: ‎04-30-2011
My Device: BlackBerry Z10

Re: Issue of verticalfieldmanager with the LableField

Hello Bskania

Your LabelField text will get scroll now.

Henceforth put your other UI. But don't add any UI IN this _vfm object. 
 
class Pawan extends MainScreen
{
public Pawan()
{
super(Manager.NO_VERTICAL_SCROLL);
LabelField lb = new LabelField("Pawan Jha",LabelField.FIELD_HCENTER);
add(lb);
 
VerticalFieldManager _vfm = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL ){

	protected void sublayout(int width,int height)
	{
		super.sublayout(Display.getWidth(),200);
		super.setExtent(Display.getWidth(),200);
	}
};
 
_vfm.add(new LabelField("I am developing my first blackberry application."+
		"But I am stuck with the VerticalField and the lable field."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		"pawan here. pawan here. pawan here. pawan here. pawan here. pawan here."+
		
		"But I am stuck with the VerticalField and the lable field.I want to build " +
		"one UI but I am not able to implement it. \n\n Now it is scrolling\n\n Pawan Jha"));
_vfm.setBorder(BorderFactory.createBevelBorder(new XYEdges(3,3,3,3)));
add(_vfm);
 

}
}

:smileyhappy:!!!!!!!!!!!!!!!!!!

Please use plain text.
Developer
bskania
Posts: 105
Registered: ‎04-24-2012
My Device: blackberry developer

Re: Issue of verticalfieldmanager with the LableField

[ Edited ]

@peter Yes I am giving try to the richtextfield also.

Please use plain text.
Developer
bskania
Posts: 105
Registered: ‎04-24-2012
My Device: blackberry developer

Re: Issue of verticalfieldmanager with the LableField

I am also able to do that. But I want the Ok and Cancel button in the bottommost.
Please use plain text.
Trusted Contributor
Himanshu_berry
Posts: 138
Registered: ‎04-19-2012
My Device: No

Re: Issue of verticalfieldmanager with the LableField

is my code useful to you.

Please use plain text.
Trusted Contributor
Himanshu_berry
Posts: 138
Registered: ‎04-19-2012
My Device: No

Re: Issue of verticalfieldmanager with the LableField

ok do one thing use my code and 

Do hfm.setMargin();

setMargin according to your need.

Please use plain text.
Developer
bskania
Posts: 105
Registered: ‎04-24-2012
My Device: blackberry developer

Re: Issue of verticalfieldmanager with the LableField

actually margin is available above 6.0 and I want it to work from 4.5.
Please use plain text.
Developer
bskania
Posts: 105
Registered: ‎04-24-2012
My Device: blackberry developer

Re: Issue of verticalfieldmanager with the LableField

Hello Pawan,

Thanks for your Help. It working fine.

 

But can you help me much in the setting the height of the lable field relative to button that I am going to add in the bottom.

You can see above code of Himanshu.

 

VerticalFieldManager _vfm = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL ){

	protected void sublayout(int width,int height)
	{
		super.sublayout(Display.getWidth(),(Display.getHeight() -button.getPrefferedheight()));
		super.setExtent(Display.getWidth(),(Display.getHeight() -button.getPrefferedheight()));
	}
};

 

I tried to modify your code a little bit.

But Its not allow me to restrict the lablefield height.

Pls can you tell me what I am doing wrong in that?

I  show that the sublayout method is called after all the view is added.

 

thanks in advance.

bskania.

Please use plain text.