I have a very similar question regarding the HoriontalFieldManager,
I'm trying to set up a search bar with this format
|logo|----------search_bar------------|button|
Where the logo, and button have set sizes, and the search bar fills the remaining space.
Previously I was working on android and this was easily achieved by setting the layout weight to a higher priority on the "non-filling" items.
However I can't figure out how to do this with the BB HorizontalFieldManager:
I add the logo
I add the search bar
I add the button
The logo shows up fine where I want it because it's the first thing I add to the manager, but then the search bar fills the remainder of the screen and there is no room left for my button. So it just gets pushed off the other edge where it can't be seen.
There must be a right way to do this. Am I missing something?
the code for my search bar:
Code:
public SearchBar(FieldChangeListener listener) {
super(Manager.USE_ALL_WIDTH);
this.bitmapField = new BitmapField(Bitmap.getBitmapResource("main_logo.png"));
editField = new EditField("", "", 75, EditField.NO_NEWLINE);
this.myButton = new myButton();
/*******************/
XYEdges xyedges = new XYEdges(5,5,5,5);
editField.setMargin(10, 10, 10, 10);//top,rt,btm,lft
editField.setBorder(BorderFactory.createBevelBorder(xyedges));
/*******************/
editField.setChangeListener(listener);
add(bitmapField);
add(editField);
add(myButton);
}
the code for my button:
Code:
public myButton() {
super(Manager.FIELD_RIGHT);
bitmapField = new BitmapField(Bitmap.getBitmapResource("button.png"));
add(bitmapField);
}