BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 11-16-2009, 09:01 PM   #1
keatsp
Knows Where the Search Button Is
 
Join Date: Oct 2009
Model: 8350i
PIN: N/A
Carrier: telus
Posts: 40
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
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
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
keatsp
Knows Where the Search Button Is
 
Join Date: Oct 2009
Model: 8350i
PIN: N/A
Carrier: telus
Posts: 40
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
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
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
keatsp
Knows Where the Search Button Is
 
Join Date: Oct 2009
Model: 8350i
PIN: N/A
Carrier: telus
Posts: 40
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
keatsp
Knows Where the Search Button Is
 
Join Date: Oct 2009
Model: 8350i
PIN: N/A
Carrier: telus
Posts: 40
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
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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



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


4.5 CFM Single-Stage Rotary Vacuum Pump HVAC/Auto AC 4.5CFM 1/3HP 1/4

4.5 CFM Single-Stage Rotary Vacuum Pump HVAC/Auto AC 4.5CFM 1/3HP 1/4"ACME inlet

$29.39



3 CFM Air Vacuum Pump HVAC Manifold Gauge Set AC A/C Refrigeration Kit picture

3 CFM Air Vacuum Pump HVAC Manifold Gauge Set AC A/C Refrigeration Kit

$44.83



VEVOR 9

VEVOR 9" Drywall Sander 850W Vacuum System Folding 6 Speed LED Strip Light

$87.99



Hoover WindTunnel 2 Whole House Rewind Pet Upright Vacuum Bagless Black/Brown picture

Hoover WindTunnel 2 Whole House Rewind Pet Upright Vacuum Bagless Black/Brown

$119.98



Cordless Vacuum Cleaner Stick Handheld for Carpet Pet Hair & Wood Floor Bagless picture

Cordless Vacuum Cleaner Stick Handheld for Carpet Pet Hair & Wood Floor Bagless

$96.90



NEW Portable Heavy-Duty Suction Machine HIGH SUCTION VACUUM UNIT PUMP picture

NEW Portable Heavy-Duty Suction Machine HIGH SUCTION VACUUM UNIT PUMP

$139.99







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