BlackBerry:Fixed height VerticalFieldManager - blackberry

I have a VerticalFieldManager which acts as a parent.I have added
one VFM & one HFM to the parent VFM.I want the VFM added to the parent VFM
to behave as a fixed size VFM and the conents in it should be scolled
only on scrolling.The HFM added to the parent VFM should be constantly seen
on the screen.
In short i have to display a Toolbar at the bottom of the BB screen.
I have already created a custom class by extending HFM to display a toolbar.
And only when i scroll the VFM placed in the center i should be able to
see the remaining contents.
can any one give me some idea or code to implement this?
Regards,
Yogesh Chaudhari

Take a look at MainScreen and the method setStatus. They should do what you want.

Related

How to restrict if the last field of a Vertical field maneger has focus in blackberry

I have one VerticalFieldManager with 24 editfield and labelfields.
I want to restrict the scroll: while the first Editfield has focus the scroll should not go upwards and while the last Editfield has focus the scroll should not go downwards.
Create VerticalFieldManager as below.
VerticalFieldManager vfm = new VerticalFieldManager (VerticalFieldManager.VERTICAL_SCROLLBAR | VerticalFieldManager.USE_ALL_WIDTH);

How to scroll images horizontally on a blackberry

I want to scroll the images horizontally with its title and description, I had done using picture scroll view but it shows only title that too at the bottom of the screen but i want to display it at the top and with the title i want to display its description also, please help.
And another option i had tried using the interface scrollchangelistener by using that i displayed the images with its title and description on the top of the screen but it scrolls in vertical direction i am unable to do it in horizontal. Please help i am in great difficulty since last few days, Please help.
Use HorizontalFieldManager and add the contents in it
It will work
Use Manager.HORIZONTAL_SCROLL as argument in it
eg:
HorizontalFieldManager hfm=new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);
This BlackBerry support forum thread will help you, in addition to the PictureScrollField documentation.
how to show images in horizontal scroll field in blackberr

Blackberry fieldmanager issues

I am building a blackberry app for BB Curve.I have a verticalfieldmanager where i am adding a Button,i set its extent as 320*22.I have a horizontalfieldmanager where i am adding two editfield and its extent is 296*22.Finally i am adding both these manager into another verticalfieldmanager whose extent i have set as 320*240.i use setBackgroundBitmap(Background bg) to set the background image.But when i set the extent of the main verticalfieldmanager,only the background image is set,but the other two managers where i have added editfield and button are not visible.But when i dont set the extent of the main vertical manager,than the editfield and button are added to the screen,but the background image is not added.So where i am doing wrong?
It looks like you're going to have to play with your extents to make sure that you given the child Managers enough space to layout the Fields. In your sublayout(int width, int height) of the Managers, check what dimensions are getting passed to it. If they are less than the space it needs to layout, it won't be able to display its Fields.

How to prevent scrolling in one direction in a HorizontalFieldManager?

I have a requirement for a one-line edit field that can accept text longer than the edit field's width (like a "normal" Windows textbox).
Since the BasicEditField control normally word-wraps its contents, I've implemented this requirement by placing my BasicEditField inside a HorizontalFieldManager that allows horizontal scrolling.
This works in one sense: if I type text longer than the edit field's width, the HFM automatically scrolls to the left (taking the edit field with it) which keeps the cursor visible at the right.
The problem is that the user can swipe right-to-left, which moves the BasicEditField completely off the screen to the left. I want to be able to only scroll left when the BasicEditField's contents are too wide to be shown entirely, and only allow just enough leftward scrolling to keep the cursor visible on the right.
I fought this exact scenario when implementing my own EditField. What's happening is since you allow horizontal scrolling, and an EditField by nature wants to use as much width as it can, you end up with a very wide EditField. I'm copying this from my code, so hopefully it will work for you, but if it doesn't add a comment and I'll try to see if I can help get it working.
EditField edit = new EditField(EditField.NO_NEWLINE | style) {
protected void fieldChangeNotify(int context) {
try{
super.fieldChangeNotify(context);
setExtent(this.getFont().getAdvance(this.getText()) + 10, this.getHeight());
}
catch(Exception e){
//don't recall why I needed this, but it works so I'm hesitant to remove it
}
}
protected void layout(int width, int height) {
super.layout(width, height);
setExtent(this.getFont().getAdvance(this.getText()) + 10, this.getHeight());
}
};
What this will do is progressively make the EditField wider as the text grows. I had this inside of an HFM that grew with it as well, but you might not need that. I did this because if the field grew wider than the screen width, rather than scrolling the entire screen you could let this single Field scroll horizontally. Also, the + 10 is in there because it was clipping the cursor without it. If you would like that as well I can edit this post to include it.

Adding vertical scrollbar to screen in blackberry application

hi I am new to blackberry development..
I am trying to add a vertical scroll bar on the screen, but not able to do that. because I do not know the way.
VerticalScrollManger scroll = new VerticalScrollManager(Manager.VERTICAL_SCROLL);
please give me the solution.
thanks
Things that extends net.rim.device.api.ui.Manager (like a VerticalFieldManager) can have style bits set in the constructor that specify which type(s) of scrolling you want and whether or not the scrollbars (arrows) should be displayed. Put your Field into a manager that has scrolling enabled and set the manager for the screen You need to set the manager containing the component/field that is too large for the screen to have scrolling enabled AND scrollbars drawn to see scroll arrows.
The style bits you want to set are: Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR
If your UI is built on top of the blackberry classes MainScreen or FullScreen, you can use the constructor taking an argument of type long to set the style bits: MainScreen(long style) could be called as MainScreen(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); to set the style bits for the screen to include scrolling and vertical scroll indicator arrows.
There is an occasional issue that FieldManagers that are fixed size will sometimes not show scroll arrows (but they'll still scroll). See Blackberry VerticalFieldManager with fixed size : Scroll issue if you are concerned about that issue.
If by scrollbars you mean the small blue arrows, then you can get these to display using the method Jessica described above (set style bits VERTICAL_SCROLL and VERTICAL_SCROLLBAR). However, if by scrollbars you are referring to actual bars that indicate the scrolled position (as seen in the Browser app) then you would need to draw these on the manager yourself, as the BlackBerry API doesn't provide you with any way to display them automatically.
To do something like that you'd need to subclass VerticalFieldManager and override the paint method. Use a combination of the screen height (Display.getHeight()), the manager height (getVirtualHeight()) and the scroll position (getVerticalScroll()) to calculate the Y position and height of the bar, and then draw it on the screen using g.drawRect() or something similar.
If you want a fancier-looking scrollbar, take a look at my article in BlackBerry knowledge base:
http://supportforums.blackberry.com/t5/Java-Development/Implementing-a-standard-style-scrollbar-on-a-Blackberry-device/ta-p/504416

Resources