BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-29-2007, 01:12 PM   #1 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100T
PIN: N/A
Carrier: cingular
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with field location

Please Login to Remove!

i'm tackled with a problem that is making me spend way more time than i should. i have a screen which lists a number of items. all the items are individual fields and each occupy one line on the screen. (similar to the list view of a folder in windows). i add the fields to the default manager of a MainScreen, and it is the only manager i have in the screen. all i need to do is to be able to get the index of the first visible item on the screen. the isVisible() method of the Field class is not a solution to my problem because it treats all the fields as visible when the screen they belong to is the topmost screen on the display stack. i just need to learn the index of the first field that is within the visible region of the screen. is there a way for me to do that?
Offline  
Old 10-30-2007, 02:48 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

try Field.getExtent() or something similar. Get the screen size and you should be able to calculate this.
implement a check in a focuschangelistener that calculates the position of the focussed field relative to each field and you should be able to determine if a field is visible.

hth,
simon
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 10-30-2007, 09:38 AM   #3 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100T
PIN: N/A
Carrier: cingular
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can you elaborate a little bit on this? getExtent() and similar methods are giving me the location relative to the manager, which is not what i need.
Offline  
Old 10-30-2007, 09:47 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

your manager is the whole screen. lets say it is 320*240
if Field.getContentTop() is > 240 it is not visible by default.

to get scrolling into it you add 240 to the getContentTop() of the focussed field and compare it to Field.getContentTop()

its just an idea out of my head, nothing i tested
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 10-30-2007, 10:08 AM   #5 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100T
PIN: N/A
Carrier: cingular
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, now I understand what you are saying. However, this still does not solve my problem. There is no guarantee that the field with focus is the topmost item in the visible region of the screen. It might as well be 5th, 6th, etc. item.
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.