BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 07-25-2007, 04:31 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default ButtonField - Is there an easy way to set the width?

Please Login to Remove!

Hi Folks,

Does anyone know of an easy way to set the width of a ButtonField?

(Or any other field for that matter).

Thanks,

Mike

Last edited by bbCincinnati : 07-25-2007 at 04:41 PM. Reason: clarification
Offline  
Old 07-26-2007, 10:01 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

*: Create a custom class extending the field you want to modify
*: override getPrefferedWidth, return the size you want in pixels.
Offline  
Old 07-26-2007, 11:35 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Thanks! That worked.

Thanks Bemshaswing!
That's exactly what I needed


In case it might be helpful to someone else, here is my code:

The overridden ButtonField class:
Code:
class MyButtonField extends ButtonField
{
    private int width;

    MyButtonField( String label, int Width)
    {   super( label);
        width = Width;
    }
    public int getPreferredWidth()
    {   return width;
    }
}
And later, here's when I instantiate it:
Code:
private MyButtonField  btnB1 =  new MyButtonField( "Test", 100);

Thanks again,

Mike

Last edited by bbCincinnati : 07-26-2007 at 11:38 AM. Reason: code correction
Offline  
Old 07-27-2007, 03:03 AM   #4 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

nice! thanks. (i'll blog about this later - is very useful)
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 07-27-2007, 03:29 AM   #5 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

here you go: BlackBerry Fixed Width ButtonField
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 07-27-2007, 07:35 AM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nicely done
Offline  
Old 07-27-2007, 09:51 AM   #7 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jun 2007
Location: Cincy, 0
Model: 8100
Carrier: CBW
Posts: 360
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Welcome fellow Cinci...natian. hehe
__________________
Thx
Low
Offline  
Old 08-11-2007, 01:48 PM   #8 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Lowrider View Post
Welcome fellow Cinci...natian. hehe
Thanks Low!
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

AGILENT HP 16078A ADAPTER (4145A SEMICONDUCTOR PARAMETER ANALYZER-4085A)
$149.99
AGILENT HP 16078A ADAPTER (4145A SEMICONDUCTOR PARAMETER ANALYZER-4085A) picturePeak DCA75 Atlas Advanced Semiconductor Analyser with Curve Tracing
$152.94
Peak DCA75 Atlas Advanced Semiconductor Analyser with Curve Tracing pictureBT134W-800 NXP SEMICONDUCTORS LOT PB124603G102 (QTY 1000 PIECE)
$129.0
BT134W-800 NXP SEMICONDUCTORS  LOT PB124603G102 (QTY 1000 PIECE) pictureBuss Semiconductor Fuse FWH-1000 1000A 500V, FWH1000
$167.4
Buss Semiconductor Fuse FWH-1000 1000A 500V, FWH1000 pictureREPLACEMENT SEMICONDUCTORS AND TRANSISTORS SEE LIST NEW ECG, NTE ETC
$59.52
REPLACEMENT SEMICONDUCTORS AND TRANSISTORS SEE LIST NEW ECG, NTE ETC  picture






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