04-27-2009 04:04 PM
Hello,
I have a screen with several fields in a VerticalFieldManager.
I would like a focused field to be as much near the top of the screen as possible when I call setFocus on it.
Right now, the focused field is on the bottom of the screen (as if I scrolled down until I reached it).
I want it to be on the top of the screen.
How can I do that?
thanks
Solved! Go to Solution.
04-27-2009 04:10 PM
call the setFocus() method on the field that you want to have the focus.
04-27-2009 04:12 PM
04-27-2009 04:14 PM
Sorry, you've lost me.
If you want the last field at the bottom of the screen to be at the top of the screen, then you need to put it there.
04-27-2009 04:17 PM
Not sure you got what I meant.
I have a vertical field manager too big for the screen. I have a button at the top of the VFM.
When I press the button I want to "search" for a field. At the moment I use setfocus on my field, but when I do that the field is a the bottom of the screen, like this:
-------------------------
blabla1
blabla2
blabla3
blabla4
FOCUSEDFIELD
-------------------------
I want it to be like that:
----------------------
FOCUSEDFIELD
blabla5
blabla6
blabla7
-----------------------
How I can put it up more?
04-27-2009 04:21 PM
Look at Manager.moveFocus()
04-28-2009 11:38 AM
I tried it but thats not what I need since I don't know how many field there is going to be below.
I really just want to dynamically select a field and "put" it at the top of the screen.
04-28-2009 11:58 AM
Solved it:
((TitleField)mgr.getField(0)).setFocus(); // scroll it to the bottom of the screen getScreen().scroll(Screen.DOWNWARD); // make it go up but focuses the bottom most element ((TitleField)mgr.getField(0)).setFocus(); // reset the focus to the field, now at the top