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

DEC LSI-11 CPU M7270 VERY Rare Vintage, Year 1977,1980, TOP Condition
$49.99
DEC LSI-11 CPU M7270 VERY Rare Vintage, Year 1977,1980, TOP Condition  pictureVintage SIGNODE Crimping W14 Tool 17.5" long pat#1784123 dec9 1930 /N12167
$64.99
Vintage SIGNODE Crimping W14 Tool  17.5Vintage Digital DEC M3106 Line SYNC MUX Board
$29.99
Vintage Digital DEC M3106 Line SYNC MUX Board pictureVintage Sheet Metal Worker’s Monthly magazine Dec.1940
$2.99
Vintage Sheet Metal Worker’s  Monthly magazine Dec.1940  pictureVintage Rare DEC 1073D / 1996 JD3487 H 9833
$49.99
Vintage Rare DEC 1073D  / 1996 JD3487 H 9833    picture






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