BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-05-2008, 11:24 PM   #1 (permalink)
New Member
 
Join Date: Aug 2008
Model: 7100T
PIN: N/A
Carrier: Don't know
Posts: 8
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default How to make scroll in the long list ObjectChoiceField

Please Login to Remove!

Hi everyone, Could anyone help me out?
My problem is I have a list of ObjectChoiceField having 10 items. It occupies my whole BlackBerry screen. Now I would like to shorten the list having for example 4 items and using scroll to move down to 10th item. Thanks in advance.
Offline  
Old 08-06-2008, 03:21 AM   #2 (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

first you should limit your field to four items. then you overwrite the scrolling behaviour and exchange the items. or you build yourself something to turn the pages like 1-2 small buttons, would make it easier.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 08-06-2008, 03:37 AM   #3 (permalink)
New Member
 
Join Date: Aug 2008
Model: 7100T
PIN: N/A
Carrier: Don't know
Posts: 8
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, I will try to do what u suggested me.
Offline  
Old 08-18-2008, 05:10 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2007
Location: Bangladesh
Model: 8800
PIN: N/A
Carrier: EDGE
Posts: 93
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try with HorizontalFieldManager.

Cheers,
ARIF
Offline  
Old 08-19-2008, 03:45 AM   #5 (permalink)
New Member
 
Join Date: Aug 2008
Model: 7100T
PIN: N/A
Carrier: Don't know
Posts: 8
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried to use HorizontalFieldManager but I cant solve the problem. Here is my code. Can u and simon.hain help me out?

public class LimittedObjectChoiceField extends MainScreen{
public LimittedObjectChoiceField(){
String option[] = {"Opt 1", "Opt 2", "Opt 3", "Opt 4", "Opt 5", "Opt 6", "Opt 7", "Opt 8", "Opt 9", "Opt 10"};
ObjectChoiceField choice = new ObjectChoiceField("Object Choice Field: ", option, 0);
HorizontalFieldManager mgr = new MyHorizontalFieldManager();

mgr.add(choice);

add(mgr);
}
}

class MyHorizontalFieldManager extends HorizontalFieldManager{

public MyHorizontalFieldManager()
{
super();
}
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(width, maxHeight);
setExtent(width, getExtent().height);
}

public int getPreferredWidth()
{
return width;
}

}
Offline  
Old 08-19-2008, 11:37 AM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: Dec 2005
Model: 8310
Carrier: Rogers
Posts: 138
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should be aware that the ObjectChoiceField component uses an internal class to render the choice popup. The object is private so you cannot manipulate it. If you want to achieve what you are trying to do, you will have to write your own popup class. A good way to start is to inherit from screen and override sublayout. Then you can manipulate the position and size of your popup screen with setPosition and setExtent respectively. You can use a VerticalFieldManager as your delegate to the screen to achieve the scrolling effect you're after. Good luck!
Offline  
Old 08-19-2008, 10:39 PM   #7 (permalink)
New Member
 
Join Date: Aug 2008
Model: 7100T
PIN: N/A
Carrier: Don't know
Posts: 8
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for yr kindness. I will do what you mentioned
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.