BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 08-20-2010, 09:48 PM   #1 (permalink)
New Member
 
Join Date: Apr 2010
Model: 8110
PIN: N/A
Carrier: usb
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help for resize the ButtonField and the ObjectChoiceField

Please Login to Remove!

Hi everybody,now I have some questions with using Buttonfield and ObjectChioceField.
In my program,I have one ButtonFiled and two ObjectChoiceField. I would like they are arranged in a row,but the width of the screen is not enough show them all.


Following is my key code
Code:
final class CameraScreen extends MainScreen
{
    private AutoWidthButtonField _photoButton;
    private sObjectChoiceField enChioceField;    
    private sObjectChoiceField zoomChoiceField;
......
......
    public void createUI()
    {
...
        _photoButton = new AutoWidthButtonField( "Take" );
       enChoiceField = new sObjectChoiceField(null, _encodings, 0);
       zoomChoiceField = new sObjectChoiceField(null, zoom, 0);

      FlowFieldManager hfm = new    FlowFieldManager(net.rim.device.api.ui.Manager.FIELD_HCENTER);
        hfm.add(_photoButton);        
        hfm.add(_encodingField);
        hfm.add(zoomField);

        add(hfm);
    }
}

final class AutoWidthButtonField extends ButtonField
{
    AutoWidthButtonField(String label) { super(label); }
    public int getPreferredWidth()
    {
        int width = (Display.getWidth() / 10);
        return width;
    }
    /*
    protected void layout(int width, int height)
    {  
        super.layout(width, height);
        setExtent(getPreferredWidth(), getPreferredHeight());
    }
    */
}

final class sObjectChoiceField extends ObjectChoiceField
{
    sObjectChoiceField(String label, Object[] choices, int initialIndex) { super(label,choices,initialIndex); }
    public int getPreferredWidth()
    {
        int width = (Display.getWidth() / 10);
        return width;
    }
    /*
    protected void layout(int width, int height)
    {  
        super.layout(width, height);
        setExtent(getPreferredWidth(), getPreferredHeight());
    }
    */
}
The result is the width of the button field has been resize,but the label can not be showed.
But it is not work to the ObjectChoiceField.

So my questions are how to resize the width of the buttons,and how to resize the Font size to suit the field.

Last edited by bitpanda : 08-20-2010 at 10:24 PM.
Offline  
Closed Thread


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

St. Louis Rams NFL Hot Sexy Girl Fridge Magnet Size 2"x 3"
$3.99
St. Louis Rams NFL Hot Sexy Girl Fridge Magnet Size 2100pcs/lot 15x15.5x5mm Aluminum Heat Sink With Thermal Tape for RAM IC CPU
$14.0
100pcs/lot 15x15.5x5mm Aluminum Heat Sink With Thermal Tape for RAM IC CPU pictureADVANTECH PCA-6186 SINGLE BOARD COMPUTER W/ CPU & RAM USED #7
$219.98
ADVANTECH PCA-6186 SINGLE BOARD COMPUTER W/ CPU & RAM  USED #7 pictureSt. Louis Rams NFL Hot Sexy Girl Fridge Magnet Size 2"x 3"
$3.99
St. Louis Rams NFL Hot Sexy Girl Fridge Magnet Size 2**NEW** RAM ELECTRONIC CORP CDS-5 Dryer IGNITOR ,IGNITION CONTROL CDS-5
$69.99
**NEW** RAM ELECTRONIC CORP CDS-5 Dryer IGNITOR ,IGNITION CONTROL CDS-5 picture






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