I'm using an EyelidFieldManager on a MainScreen of my Blackberry app. Here is the code
EyelidFieldManager manager = new EyelidFieldManager();
HorizontalFieldManager buttonFieldSet = new HorizontalFieldManager(USE_ALL_WIDTH);
buttonFieldSet.addAll(new ButtonField[] {new ButtonField("One"), new ButtonField("Two"), new ButtonField("Three")});
manager.addBottom(buttonFieldSet);
manager.setEyelidDisplayTime(3000);
add(manager);
Nothing gets shown at the bottom of the screen but when I change the line manager.addBottom(buttonFieldSet) to manager.addTop(buttonFieldSet) the HorizontalFieldManager gets displayed at the Top.
Why does this happen? Why is the EyelidFieldManager able to show the HorizontalFieldManager when it's docked at the top but not when its docked at the bottom.
Hey even i have been presently working with the eyelid field manager and i am getting the bottom dock perfectly.
Check this
// Add components to the south eye-lid of the blinker
_eyelidFieldManager.addBottom(new LabelField(" Send Report as: ",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
HorizontalFieldManager buttonPanel = new HorizontalFieldManager(Field.FIELD_HCENTER | Field.USE_ALL_WIDTH);
buttonPanel.add(new ButtonField("One"));
buttonPanel.add(new ButtonField("Two"));
buttonPanel.add(new SimpleButton("Three"));
_eyelidFieldManager.addBottom(buttonPanel);
Eyelid Field manager has been defined like this:
private EyelidFieldManager _eyelidFieldManager;
and then this _eyelidFieldManager = new EyelidFieldManager();
You can refer to my complete code here where i have tried using them within tabs
Usage of vertical field manager with eyelid field manager in blackberry
Hope it helps.
Related
I searched how to set header and footer in BlackBerry and I found the functions setTitle() and setStatus().
My problem is I have created a class that extends VerticalFieldManager. In VerticalFieldManager, it is not showing me setStatus function as this is function of MainScreen class.
You're right. A VerticalFieldManager does not allow you to setStatus() directly.
It's important to understand the relationship between the classes in the BlackBerry UI framework.
First of all, there are Screen classes. Normally, a Screen will take up the entire device screen. You can have many different Screen classes in your app. Maybe one Screen for a splash image, one screen for a map view, one screen for settings, etc.
Inside your screens, you will often have Manager classes. A VerticalFieldManager is a kind of Manager that arranges its contents top-to-bottom, in the order that you add them. A Manager holds a group of related objects, but it does not have to span the full screen height, or width.
Inside your managers, you will usually have multiple Field objects. A Field is the individual item in the heirarchy. ButtonField, EditField, or BrowserField are all kinds of fields. They will usually be added to managers (containers). Those managers will then usually be added to screens.
So, in your case, I think what you should have is a screen class. In that screen class, you will set the header and footer by calling setTitle() and setStatus(). The content between the header and footer will all be contained in a VerticalFieldManager that you add to the screen. Something like this:
public class MyScreen extends MainScreen {
public MyScreen() {
super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);
// set a header for this screen
setTitle("My Header / Title");
// screen contents go in the vertical field manager
// NOTE: you can replace VerticalFieldManager with your own class
// that extends Manager, or VerticalFieldManager, if you like
VerticalFieldManager vfm = new VerticalFieldManager();
vfm.add(new LabelField("One"));
vfm.add(new ButtonField("Two", ButtonField.CONSUME_CLICK));
vfm.add(new CheckboxField("Three", true));
add(vfm);
// use a bitmap as a footer
Bitmap footer = Bitmap.getBitmapResource("footer.png");
setStatus(new BitmapField(footer));
}
}
How can we show Scrolling feature in blackberry 9300 (Small screen) to show more line of contents.
Thanks
Aditya
Try this code -
VerticalFieldManager vfm=new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.HORIZONTAL_SCROLL);
Add all your fields to vfm.
You have to set Property of your Manager as Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR. Than add your Field (LabelField , ButtonField ... ) in that Manager and try .
I want to make one search bar on top of the mainscreen and this search bar should include one editfield and one image of search icon.
Please help me...
Thanks, in advance
You need to use an HorizontalFieldManager to put editfield and image on the same line. Read here http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/ui/container/HorizontalFieldManager.html and here: http://www.androidadb.com/class/ho/HorizontalFieldManager.html , a simple example showing how adding two buttons in an HorizontalFieldManager. Just substitute buttons with yor needed fields.
Or you can play with GridFieldMgr:
GridFieldManager gridMgr_g = new GridFieldManager(1, 2, 0);
gridMgr_g.setColumnProperty(0, GridFieldManager.FIXED_SIZE, screenWidth-myBitmapRes.width);
gridMgr_g.setColumnProperty(1, GridFieldManager.FIXED_SIZE, myBitmapRes.width);
gridMgr_g.add(new EditField());
gridMgr_g.add(new BitmapField(Bitmap.getBitmapResource(myBitmapRes)));
add(gridMgr_g);
when i click on Buttonfield i want to show Popup screen .everything working fine .but that PopupScreen open by default at the center of the Mainscreen.
i have already try this code.setMargin and setPosstion method to change the possition. but its not working as my requrement .
i want to open that Popupscreen at the top of Mainscreen with Animation(top to bottom).
and another issue is that in this popup screen there is one Edittextfield ..when i click on edittext field keyboard open fine but at that time device Menu button not working and i cant access keyborad hide functionality ..
how to set popup screen at the top of the mainscreen ?
Have you tried overriding the sublayout() method in the popupScreen class ?
protected void sublayout(int width, int height) {
super.sublayout(width, height);
// replace x,y with your values //
setPosition(x, y);
}
HOWEVER, if you are trying to animate the popup screen from top to bottom, you are better off using EyelidFieldManager, it does the animation for you :)
Try:
EyelidFieldManager Sample
EyelidFieldManager API
I've add some customized buttonfield follow by some label field.
When opening the app, the first buttonfield gets focus, but I don't need the focus when opening the screen. How to avoid the focus on opening the screen?
use NullField like the code below:
NullField field = new NullField();
field.setFocus();
This will avoid the focus on any field in the screen