03-01-2011 05:40 PM
On a screen, I added a few text boxes and below that a buttonField:
ButtonField registerButton = new ButtonField("REGISTER", ButtonField.CONSUME_CLICK); registerButton.setChangeListener(this); add(registerButton);
On storm 2, when I touch the button, it is not highlighted at all. The cursor stays with the first text box.
On Torch, I have to keep on sliding from the top text box toward the button to eventually get it highlighted.
What I want is to touch the button and it gets highlighted and the fieldChanged method gets called. What could be the problem that prevents it from happenning?
Solved! Go to Solution.
03-01-2011 06:07 PM
1) Have you written the text box code yourself of have you taken it from somewhere on the Net? If the latter, I hope they are not based on the old "Pimp my Object: Creating a text box field" - that one has an infinite loop of painting and invalidating and might easily throw off your focusing.
There is a "TextBoxField revisited" knowledge base article with much more robust code and a slightly neater looking result.
2) Do you have any onUnfocus overrides in your text boxes? If yes, do they ever try to set focus on anything?
03-01-2011 06:55 PM
Any touchEvent overrides?
03-01-2011 07:12 PM
no. but with a small correction (which may or may not make a big difference)...
The textbox and button are added to a VerticalFieldManager which is then added to the screen. (Instead of being added directly to the screen)
The VerticalFieldManager is screen width. The textbox and button are less than the screen width.
03-01-2011 07:22 PM
Weird... That shouldn't make any difference. Can you replace text boxes with simple edit fields and see if the result changes?