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 / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chips *NEW* 40278101
$60.0
DEC / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chips *NEW* 40278101  pictureSET/LOT 3x GOLD 6" WAFERS: MICROMODULE SYSTEMS GEMINI CPU OLD VINTAGE IC DEC MCM
$199.95
SET/LOT 3x GOLD 6Vintage SIGNODE Crimping W14 Tool 17.5" long pat#1784123 dec9 1930 /N12167
$85.49
Vintage SIGNODE Crimping W14 Tool  17.5VTG Smead BLUE Jan - Dec Index Card Guides No. 621-12 Months 6" x 4" Dividers
$11.99
VTG Smead BLUE Jan - Dec Index Card Guides No. 621-12 Months  6Hand Glove Vintage Mannequin General Porcelain Sz 8 HH Trenton NJ Dec. 15, 1971
$55.0
Hand Glove Vintage Mannequin General Porcelain Sz 8 HH Trenton NJ Dec. 15, 1971 picture






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