Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
08-20-2009 04:20 PM
I am new-bie, wanna provide space for two buttons. For ex: I have two buttons such as A and B. I code such a way that 'FieldListener' and add(xxx)' does that thing.
If i want to provide space between button A and B, how to do that? May be, button A can be on top and button B can be on bottom of the screen.
Solved! Go to Solution.
08-20-2009 04:31 PM
You can use setMargin() for this purpose.
Try something like this:
ButtonField topButton = new ButtonField( "Top Button"); int topEmptySpace = ( Display.getHeight() - topButton.getPreferredHeight() - 10 /*10 for safe margin*/) ; ButtonField bottomButton = new ButtonField( "Bottom Button"); bottomButton .setMargin(topEmptySpace, 0, 0, 0); this.add(topButton); this.add(bottomButton);
08-21-2009 01:13 AM
As bikas suggested setMargin() is a better way of doing ,there one otherwork around also have a look at this thread
08-22-2009 04:56 PM
Ok. I added import as 'import net.rim.device.api.system.Display;' and no compilation error found.
But button is not showing up in the bottom space. I have total four buttons, Btn1, Btn2, Btn3 and 'Home' button. I want 'Home' button to be placed bottm, other buttons can be upper portion one by one.
I tried the same sample piece of code but 'Home' button is not showing in the bottom instead it shows normally down after the third button.
Could somone review it?
ButtonField homeBtn= new ButtonField("Home", ButtonField.CONSUME_CLICK);
int topEmptySpace = ( Display.getHeight() - Btn1.getPreferredHeight() - 10 /*10 for safe margin*/) ;
homeBtn.setMargin(topEmptySpace, 0, 0, 0);
08-23-2009 12:56 AM
Try like this:
ButtonField btn1 = new ButtonField("Btn1"); ButtonField btn2 = new ButtonField("Btn2"); ButtonField btn3 = new ButtonField("Btn3"); HorizontalFieldManager hfmTop = new HorizontalFieldManager(); hfmTop.add(btn1); hfmTop.add(btn2); hfmTop.add(btn3); ButtonField btnHome = new ButtonField("Home"); HorizontalFieldManager hfmHome = new HorizontalFieldManager(); hfmHome.add(btnHome); int topEmptySpace = ( Display.getHeight() - (hfmTop.getPreferredHeight() + btnHome.getPreferredHeight() + 10) ) ; hfmHome.setMargin(topEmptySpace, 0, 0, 0); this.add(hfmTop); this.add(hfmHome);