BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-16-2009, 09:01 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Oct 2009
Model: 8350i
PIN: N/A
Carrier: telus
Posts: 40
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Hour/minute field

Please Login to Remove!

I need the user to enter hours and minutes in my app. In the calendar app there is a field to enter hours and minutes which would be perfect but I'm not sure how its done. The label "Duration" is aligned left and aligned right is a two part field to enter the hours and minutes. It's perfect for my app if only I could figure out how to do it. Can anyone help?
Offline  
Old 11-17-2009, 02:17 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use this code.
Code:
DateField  dateField = new DateField("", 0, new SimpleDateFormat("h 'Hour' m 'Mins'"), DateField.TIME);
__________________
blog.vimviv.com
Offline  
Old 11-17-2009, 09:06 PM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Oct 2009
Model: 8350i
PIN: N/A
Carrier: telus
Posts: 40
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great thanks for the advice. Now what if I wanted to use the same format but for something other than hours and minutes. Can I change the ranges of numbers. Can I make it so the user can select 1 to 1024 in half the field and 1-8 in the other. This seems like a very useful field if I can customize the ranges.
Offline  
Old 11-17-2009, 11:52 PM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think its not possible because
Hours must be between 0 and 23, and Minutes must be between 00 and 59.
if you want something else, you have to create your own custom date field.
__________________
blog.vimviv.com
Offline  
Old 11-18-2009, 05:33 PM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Oct 2009
Model: 8350i
PIN: N/A
Carrier: telus
Posts: 40
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I realize I will have to make a custom field but have never done it and was hoping for some basic code to get me started. Right now I use three seperate numeric fields for the user to enter three different ranges of numbers that all relate to each other (like a date). It would be great if I could do this with one custom field but I'm not sure where to start.
Offline  
Old 11-20-2009, 06:47 PM   #6 (permalink)
Knows Where the Search Button Is
 
Join Date: Oct 2009
Model: 8350i
PIN: N/A
Carrier: telus
Posts: 40
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I looked into custom fields a little more and learnt how to override methods like paint and layout. So I guess what I need is a list of the methods that the date field uses so I know what to override.
Offline  
Old 11-20-2009, 11:27 PM   #7 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

I think you were on the right track in your 4:33 post.

Create your own custom field class subclassing Manager (which also implements field), and adding your three separate numeric input fields to it.

At least, that's the way I would proceed.
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





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