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

new Pneumatic Mount Directional Control Solenoid Air Valve 24V DC/model SN-3E
$50.0
new Pneumatic Mount Directional Control Solenoid Air Valve 24V DC/model SN-3E pictureParker Kuroda SPCHA7-25-12-Z3-B, PCD245-NB-D24 Pneumatic Cylinder w/ Solenoid Va
$149.0
Parker Kuroda SPCHA7-25-12-Z3-B, PCD245-NB-D24 Pneumatic Cylinder w/ Solenoid Va pictureLot of 5 Parker 422CA411D23L, 422CA11A23L Solenoid Valves w/ Light and Solenoid
$149.0
Lot of 5 Parker 422CA411D23L, 422CA11A23L Solenoid Valves w/ Light and Solenoid  pictureLot of 13 Bosch S4-S7, 0820055101, 0820055501, 0820055601 Solenoid Valves w/ Man
$299.0
Lot of 13 Bosch S4-S7, 0820055101, 0820055501, 0820055601 Solenoid Valves w/ Man pictureLot of 8 Festo IIFG-02-1/8-12-BU, MVH-5-1/8 B-VI Solenoid Valves w/ Manifold T71
$249.0
Lot of 8 Festo IIFG-02-1/8-12-BU, MVH-5-1/8 B-VI Solenoid Valves w/ Manifold T71 picture






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