tags:

views:

954

answers:

4

Dear Friends,Can any one tell me how to move the focus to next component in the screen .Actually i am having one verticalmanager with verticalscroll this vertical field manager consists of edit field with approximately 100 lines of data.Below this vertical field manager i am having one button .If i want to move my focus to that button means i have to pass through all those 100 lines in that edit field.Is there is any other way to pass the focus to button directly by clicking single button.If you have any idea to solve this problem pls help me if you can pls provide me some code snippet. regards, s.kumaran.

A: 

You would have to extend one of the containers of the edit field, process key presses looking for the key press you select (it will have to be one not consumed by the edit field). When received call the setFocus() method on the button.

Richard
Hi richard, thanks for ur idea but i already tried this idea.But when i am implementing this idea i can switch to button directly but if i want to edit anything in that editfield then i could not able to do that.Here i have typed the code which i used to use swith to button by pressing "ESC" key.public boolean keyChar(char key, int status, int time) { if(key==Characters.ESCAPE) { submit.setFocus(); } return true; }
Kumar
A: 

You could make the field with the 100 lines of text unfocusable. When it is unfocusable, and you scroll over it, the cursor should skip the 100 lines, and go straight to the button at the bottom.

gburgoon
A: 

There are options:

  • use navigationMove (if dx > some value) if edit field not in edit mode
  • use menu instead of buttons
  • use hotkeys
  • use paging in list so there will be no scrolling
Max Gontar
+1  A: 
paracycle
Hey paracyle thanks yar...it's working thanks for ur help
Kumar
ESCAPE may not be the best choice since it is also used to close screens. Perhaps using status to also select on Alt status.If as the code implies the button is to submit the data, there are two solutions that would bring the UI more in line with the standard blackberry interface semantics:1) create a menu with a submit option2) override onSave for the screen to change the dialog to Submit (instead of save), Discard, Cancel
Richard
Yes, I realize that ESCAPE might not be the best choice. However, the original poster mentioned in a comment that he was using ESCAPE for this purpose and that is why I wrote it like that. I can edit the post to clarify that though.
paracycle