BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 12-02-2009, 05:31 AM   #1
clavemartin
New Member
 
Join Date: Aug 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 14
Default Align buttons in the bottom of the screen?

Please Login to Remove!

I have developed a home screen of my application using VerticalFieldManager and added a background image, label, rich text field etc. I am trying add three buttons now. I want to have three buttons such as "Add", "Edit" and "Delete" buttons in entirely bottom of the screen with the same size. But if i add buttons using HorizontalFieldManager and add to main manager, it shows all the buttons in the top (next line of whatever the contols thee in the top) and also button size varies. How do i create same size buttons and move only those buttons to the bottom of the screen.
Note: I have not developed custom manager.


I want your help with some sample code or link.

Thanks.
Offline  
Old 12-02-2009, 05:47 AM   #2
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

For positioning button manager just override sublayout of main manager.
Code:
protected void sublayout(int width, int height) {            
buttonManager= getField(what-index-of-this-manager);
            buttonMgrHeight = buttonManager.getPreferredHeight();           
            layoutChild(footer, width, buttonMgrHeight );
           setPositionChild(footer, 0, Display.getHeight()- buttonMgrHeight ); 
            setExtent(width,height);
}
for fixed size button create a customButtonclass ,override layout method and fix the size.
__________________
blog.vimviv.com

Last edited by vivartpandey; 12-02-2009 at 05:48 AM..
Offline  
Old 12-02-2009, 05:57 AM   #3
clavemartin
New Member
 
Join Date: Aug 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 14
Default

What is 'buttonManager' and 'what-index-of-this-manager' and 'buttonMgrHeight ' here?

Thanks.
Offline  
Old 12-02-2009, 06:02 AM   #4
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

Quote:
Originally Posted by clavemartin View Post
I have developed a home screen of my application using VerticalFieldManager and added a background image, label, rich text field etc. I am trying add three buttons now. I want to have three buttons such as "Add", "Edit" and "Delete" buttons in entirely bottom of the screen with the same size. But if i add buttons using HorizontalFieldManager and add to main manager, it shows all the buttons in the top (next line of whatever the contols thee in the top) and also button size varies. How do i create same size buttons and move only those buttons to the bottom of the screen.
Note: I have not developed custom manager.


I want your help with some sample code or link.

Thanks.
that HFM i have taken as buttonmanager and in the main manager you can have more than one fields or managers so in getField(index)
you will pass the index of buttonmanager.
__________________
blog.vimviv.com
Offline  
Old 12-02-2009, 06:17 AM   #5
clavemartin
New Member
 
Join Date: Aug 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 14
Default

Resolved. Thank you very much. I am able to show the buttons in the bottom by using this.setStatus(horizontalFldManager);
May i know how can i make all the buttons with same size(height and width)
Offline  
Old 12-02-2009, 06:41 AM   #6
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

In my application i am using only one MainScreen and for different screens, i am removing all fields and adding second screen's fields. so if i am using this.setStatus(HFM), this status will come in all screens.
__________________
blog.vimviv.com

Last edited by vivartpandey; 12-02-2009 at 06:43 AM..
Offline  
Old 12-02-2009, 07:17 AM   #7
clavemartin
New Member
 
Join Date: Aug 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 14
Default

I'm sorry, not getting exactly what is your explanation. Ok no worries, resolved anyway leave it. I also want to know how can i make the buttons size as same for all? I have three buttons and the code will be something like below..

class MySecondScreen extends MainScreen {

private HorizontalFieldManager horizontalFldManager;

public MySecondScreen ()
{
.................................................. ................
.................................................. .................

horizontalFldManager = new HorizontalFieldManager(Manager.USE_ALL_WIDTH);

ButtonField addButton;
addButton = new ButtonField("Add", ButtonField.CONSUME_CLICK);

ButtonField editButton;
editButton = new ButtonField("Edit", ButtonField.CONSUME_CLICK);

ButtonField deleteButton;
deleteButton = new ButtonField("Delete", ButtonField.CONSUME_CLICK);

horizontalFldManager.add(addButton);
horizontalFldManager.add(editButton);
horizontalFldManager.add(deleteButton);

this.setStatus(horizontalFldManager);

.................................................. ................

.................................................. ................


}
Offline  
Old 12-02-2009, 08:05 AM   #8
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

customButton.java file
Code:
public class customButton extends ButtonField{

	int buttonWidth;
	public customButton(String label,long style,int width) {
		super(label,style);
		buttonWidth = width;
	}
	protected void layout(int width, int height) {
		
		super.layout(buttonWidth, height);
	}
}
main screen file
Code:
class MySecondScreen extends MainScreen {

private HorizontalFieldManager horizontalFldManager;

public MySecondScreen ()
{ 
.................................................. ................
.................................................. .................

horizontalFldManager = new HorizontalFieldManager(Manager.USE_ALL_WIDTH);

customButton addButton;
addButton = new customButton("Add", ButtonField.CONSUME_CLICK,50);

customButton editButton;
editButton = new customButton("Edit", ButtonField.CONSUME_CLICK,50);

customButton deleteButton;
deleteButton = new customButton("Delete", ButtonField.CONSUME_CLICK,50);

horizontalFldManager.add(addButton);
horizontalFldManager.add(editButton);
horizontalFldManager.add(deleteButton);

this.setStatus(horizontalFldManager);

.................................................. ................

.................................................. ................


}
__________________
blog.vimviv.com

Last edited by vivartpandey; 12-02-2009 at 09:45 AM..
Offline  
Old 12-02-2009, 08:43 AM   #9
clavemartin
New Member
 
Join Date: Aug 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 14
Default

Hello,

How it is possible to add two classes with different name in a single java file as you pasted like the code?
Offline  
Old 12-02-2009, 09:01 AM   #10
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

yaar,
i am just giving you a hint for your problem.
like
in your class your will get compiler error on this line
.................................................. .................................................. .........
.................................................. .................................................. .........
did i say that both are in the same file.
first one is my class file and 2nd one is your class file with some modification.

you can write any no. of classes in your single file but public class should be one.
__________________
blog.vimviv.com
Offline  
Old 12-02-2009, 09:07 AM   #11
clavemartin
New Member
 
Join Date: Aug 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 14
Default

Well. Thanks. I knew it already, just was wondering. Anyway i created another file for Custom Button control. But now the buttons are created from custom class, doesn't show in the bottom of the screen, instead it is displaying top most place on the screen. Code is something like below ...

CustomControl buttonControl;
add(buttonControl = new CustomControl("Add", ButtonField.CONSUME_CLICK, 20) );
.................................................. ...........
.................................................. ...........
_container.add(mainVerticalManager);
this.add(_container);
Offline  
Old 12-02-2009, 09:29 AM   #12
clavemartin
New Member
 
Join Date: Aug 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 14
Default

I Resolved it completely vivartpandey. Thanks for your co-operation.
Offline  
Old 12-03-2009, 05:43 AM   #13
clavemartin
New Member
 
Join Date: Aug 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 14
Default Multiple Data storage in my application.

Sorry for this...i created new thread for this ....

Last edited by clavemartin; 12-03-2009 at 05:44 AM..
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


 FANUC A16B-3200-0810 Motherboard picture

FANUC A16B-3200-0810 Motherboard

$5705.11



Fanuc Motherboard A16B-3200-0429/07B picture

Fanuc Motherboard A16B-3200-0429/07B

$640.54



Fanuc PC Wide Mini Motherboard EE-5770-010-002 A20B-8101-0350/02B picture

Fanuc PC Wide Mini Motherboard EE-5770-010-002 A20B-8101-0350/02B

$149.95



1PCS FANUC System Motherboard A20B-8100-0662 picture

1PCS FANUC System Motherboard A20B-8100-0662

$1697.00



Used & Tested IPC PCI-6870F Motherboard picture

Used & Tested IPC PCI-6870F Motherboard

$255.11



DSC PC1832 PowerSeries 8-32 Zone Alarm System Motherboard PC1832PCB Board Only picture

DSC PC1832 PowerSeries 8-32 Zone Alarm System Motherboard PC1832PCB Board Only

$199.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.