BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 06-19-2008, 09:01 PM   #1
jeromeng
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Cool How Do I Right Align An Editfield?

Please Login to Remove!

I am developing the options page of a small blackberry application and need to right align the EditField so it will be aligned with my drop-down menu (ObjectChoiceField).

-----------------------------
EditField _sourcePort = new EditField("Source Port:", "", EditField.DEFAULT_MAXCHARS, EditField.FIELD_RIGHT);
add(_sourcePort);
------------------------------



The code below was used to align the drop-down menu to the extreme right of the screen but i dont know how to do it for an EditField
-----------------------------
String options[] = {"Off", "15min", "30min", "45min", "1hr", "2hrs", "5hrs"};
interval = new ObjectChoiceField("Update Interval: ", options, 0);
add(interval);
--------------------------------

Please assist
Offline  
Old 06-19-2008, 09:08 PM   #2
jeromeng
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Default

Is there another JDE interface object that can accept input from a user and be right aligned like an ObjectChoiceField or NumericChoiceField? I need something like these 2 but it must be editable and alignable.

A RichTextField can be made editable by setting the Field.EDITABLE style but both the caption and the text field moves together instead of staying at extreme ends (left and right) of the screen.
Offline  
Old 06-20-2008, 05:55 AM   #3
shraddha294
Thumbs Must Hurt
 
shraddha294's Avatar
 
Join Date: Oct 2007
Location: Hyderabad
Model: 8800
PIN: N/A
Carrier: TMobile
Posts: 111
Default

I don't quite get this...so not Sure... but how about a BasicEditField ?
Offline  
Old 06-20-2008, 06:01 AM   #4
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

you can't align them properly without using your own layoutmanager.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 06-21-2008, 03:01 PM   #5
jeromeng
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Default

Quote:
Originally Posted by shraddha294 View Post
I don't quite get this...so not Sure... but how about a BasicEditField ?
BasicEditField and EditField puts the input area immediately after the field title and not at the other end of the screen.
I.e. from the code below, string "Type here" comes immediately after "Input1: " without any space. I want the layout to be like that of an ObjectChoiceField.

--------
String _default_input = "Type here";
EditField _input1 = new EditField("Input1: ", _default_input);
Offline  
Old 06-21-2008, 03:02 PM   #6
jeromeng
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Default

Quote:
Originally Posted by simon.hain View Post
you can't align them properly without using your own layoutmanager.
Hi Simon,
Can u give me a code snippet or direct me to a link where i can learn how to use a layoutmanager.
Offline  
Old 06-23-2008, 02:43 AM   #7
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

Quote:
Originally Posted by jeromeng View Post
Hi Simon,
Can u give me a code snippet or direct me to a link where i can learn how to use a layoutmanager.
sure. it's in the knowledge base
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 06-23-2008, 05:09 AM   #8
Jayaseelan
Thumbs Must Hurt
 
Join Date: Jun 2008
Location: Chennai
Model: 8130
PIN: N/A
Carrier: AIRTEL
Posts: 51
Default

Hi,
try to use this sample code for Right Align of an EditField...

EditField uName = new EditField("","",10,EditField.FIELD_RIGHT)
{
protected void paint(Graphics g)
{
if (g.getBackgroundColor() != 3098850)
{
XYRect xy = g.getClippingRect();
g.setBackgroundColor(Color.WHITE);
g.fillRect(xy.x+1,xy.y+1,xy.width+1,xy.height+1);
g.clear();
}
super.paint(g);
}
};
__________________
Jayaseelan.V
Mobile Application Developer
INDIA.
Offline  
Old 06-23-2008, 01:26 PM   #9
jeromeng
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Default

Thanx Jayaseelan and Simon but I have decided to use a drop-down for that input, it solves the align problem and prevents users from supplying invalid values thereby reducing my error handling codes.

I have another problem with thread.sleep(int value) which I will post in a different thread in this forum. Thx once again for ur help.
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

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

Forum Jump


10pcs/lot Slide Potentiometer 10K Linear Module Dual Output for Arduino picture

10pcs/lot Slide Potentiometer 10K Linear Module Dual Output for Arduino

$42.88



Dancer 138-0-0-103 Potentiometer 10k OHM picture

Dancer 138-0-0-103 Potentiometer 10k OHM

$349.50



87605245 Potentiometer For CNH tractor Holland tl70 tl80 t4020 ECC 87605247 new picture

87605245 Potentiometer For CNH tractor Holland tl70 tl80 t4020 ECC 87605247 new

$32.98



Potentiometer 87605245 For CNH tractor Holland tl70 tl80 t4020 ECC 87605247 picture

Potentiometer 87605245 For CNH tractor Holland tl70 tl80 t4020 ECC 87605247

$37.98



US Stock 10 Units 10K B10K OHM Linear Taper Rotary Potentiometer POT Blue Knob picture

US Stock 10 Units 10K B10K OHM Linear Taper Rotary Potentiometer POT Blue Knob

$8.99



10 turn Potentiometer 3590S Wirewound Variable Resistor Precision multi-turn POT picture

10 turn Potentiometer 3590S Wirewound Variable Resistor Precision multi-turn POT

$51.49







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