BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-06-2008, 11:00 AM   #1
bbCincinnati
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Default DateField - left align text - how to?

Please Login to Remove!

net.rim.device.api.ui.component.DateField

Hi Folks,

I'm trying to left align the text in a DateField. Thought it would be something simple like:

Code:
DateField df = new DateField( "", System.currentTimeMillis(), DateField.FIELD_LEFT);
or

Code:
DateField df = new DateField( "", System.currentTimeMillis(), net.rim.device.api.ui.DrawStyle.LEFT);
Either way compiles, but either way gives me an exception:

java.lang.IllegalArgumentException



Any ideas?

Thanks in advance
Offline  
Old 05-07-2008, 02:20 AM   #2
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

The same procedure as every year. Extend Field and implement your own draw-method.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 05-07-2008, 10:37 AM   #3
richard.puckett
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Default

From the api docs:

Quote:
This builds a date field, inferring the required date format for this field from the style parameter you provide. Thus, at the very least, style must include one of DATE, TIME, or DATE_TIME.
Try adding (bitwise) one of the DateTime styles to your draw style. The following works for me.

Code:
DateField df = new DateField("", System.currentTimeMillis(), DateField.DATE_TIME | DrawStyle.LEFT);
__________________
Do your homework and know how to ask a good question.
Offline  
Old 05-12-2008, 11:09 AM   #4
bbCincinnati
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Smile Thanks!

Thanks guys.

Richard, your suggestion works perfectly!

Here is an interesting side note: I'm using the 4.1 API documentation (since I'm using the 4.1 JDE), which does not mention the required use of DATE, TIME, or DATE_TIME style bits (though it makes perfect sense after you pointed it out). I found this rather strange so I "google searched" part of the phrase and found that the 4.2 API documentation DOES indeed read just like you quoted. Looks like they've updated their documentation since 4.1

4.1 documentation:
RIM Device Java Library: Class DateField)

4.2 documentation:
RIM Device Java Library: Class DateField)

Anyway, thanks again for your help!
Offline  
Old 05-12-2008, 04:44 PM   #5
jfisher
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Default

Quote:
Originally Posted by bbCincinnati View Post
I found this rather strange
The fun fun world of blackberry development!
__________________
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 05-13-2008, 07:33 AM   #6
bbCincinnati
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Default

he he he
Offline  
Old 05-19-2008, 08:28 AM   #7
navneet.gupta
Knows Where the Search Button Is
 
Join Date: Mar 2008
Model: 8100
PIN: N/A
Carrier: Airtel
Posts: 19
Default

Quote:
Originally Posted by bbCincinnati View Post
he he he
dateField = new DateField("",System.currentTimeMillis(),DateField. TIME|DrawStyle.LEFT);
Offline  
Old 05-19-2008, 09:29 AM   #8
bbCincinnati
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Default

Thanks navneet
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Welch Allyn Standard (bulb) MAC 2 Laryngoscope Blade #69042 New in OEM Box picture

Welch Allyn Standard (bulb) MAC 2 Laryngoscope Blade #69042 New in OEM Box

$19.77



10 Feet/3M For iPhone 13 12 11 PRO MAX MINI  X XR XS 8 7 Fast Charging USB Cable picture

10 Feet/3M For iPhone 13 12 11 PRO MAX MINI X XR XS 8 7 Fast Charging USB Cable

$5.00



OEM iPhone 11 PRO X/XR XS MAX 8/7 PLUS Fast Charging USB Cable 10 Feet & 6 Feet  picture

OEM iPhone 11 PRO X/XR XS MAX 8/7 PLUS Fast Charging USB Cable 10 Feet & 6 Feet

$2.99



iPhone 13 12 11 PRO MAX XR XS 8/7/6 Fast Charger USB Data Cable cord 10 feet/3M picture

iPhone 13 12 11 PRO MAX XR XS 8/7/6 Fast Charger USB Data Cable cord 10 feet/3M

$4.99



18 x Sunmed Macintosh Standard (Lamp) Laryngoscope Blades, Size 2, OEM ~17016 picture

18 x Sunmed Macintosh Standard (Lamp) Laryngoscope Blades, Size 2, OEM ~17016

$129.99



490-8 Nemco 8-Section Blade Assembly-Apple Genuine OEM NEM490-8 picture

490-8 Nemco 8-Section Blade Assembly-Apple Genuine OEM NEM490-8

$157.95







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