BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 06-19-2008, 10:01 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 10:08 PM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 06:55 AM   #3 (permalink)
Thumbs Must Hurt
 
shraddha294's Avatar
 
Join Date: Oct 2007
Location: Hyderabad
Model: 8800
PIN: N/A
Carrier: TMobile
Posts: 111
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't quite get this...so not Sure... but how about a BasicEditField ?
Offline  
Old 06-20-2008, 07:01 AM   #4 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can't align them properly without using your own layoutmanager.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 06-21-2008, 04:01 PM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 04:02 PM   #6 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 03:43 AM   #7 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 06:09 AM   #8 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2008
Location: Chennai
Model: 8130
PIN: N/A
Carrier: AIRTEL
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 02:26 PM   #9 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 26
Post Thanks: 0
Thanked 0 Times in 0 Posts
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

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.