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

VINTAGE 20" CRAFTSMAN TOOLBOX WITH WRENCHES & SOCKETS MAC, ARMSTRONG, S-K, ETC.
$119.99
VINTAGE 20Vintage Mac Tools 1-7/8” Socket 1" Drive W602 "Sabina"
$34.99
Vintage Mac Tools  1-7/8” Socket 1Vintage MAC Tools Machine Steel Numbers Stamp Set FS-316 (3/16")
$25.0
Vintage MAC Tools Machine Steel Numbers Stamp Set FS-316 (3/16Vintage MAC PB19 USA Long Industrial SCREWDRIVER flat slotted Pry Bar
$30.0
Vintage MAC PB19 USA Long Industrial SCREWDRIVER flat slotted Pry Bar pictureVintage 1/2" Drive MAC VUI 166T 6 Point Impact Swivel Socket
$11.95
Vintage 1/2






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