Catch events from a TextField

70 views Asked by At

I'm building my app using the Nokia SDK 1.0 for the Asha 501

What I want to know, is how to capture events by pressing a TextArea. I'm porting an app from the S40 and using the code below, the TextArea doesn't capture the events

TextArea itemText = new TextArea("Hello I'm a TextArea", 2, 22) {

                public void pointerPressed(int x, int y) {
                    System.out.println("PRESSED");
                }          

                public void pointerReleased(int x, int y) {
                    System.out.println("HI!");

                }
            };
            itemText.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    System.out.println("HI");
                }
            });
            itemText.setEditable(false);
            itemText.setFocusable(false);
            itemText.getStyle().setBorder(null);
            itemText.getStyle().setFgColor(Constants.Style.Color.GREY_DATE);
            itemText.getStyle().setBgTransparency(Constants.Style.TRANSPARENT);
            itemText.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL));

EDIT

Someone in the Nokia Forum, tells me to delete the itemText.setFocusable(false); line, but it doesn't work.

1

There are 1 answers

0
Mun0n On BEST ANSWER

I've finally found what is the problem, I don't know the reason why but that's it.

Removing this line

itemText.setEditable(false);

the TextArea catches the events.

I don't find the reason that in Nokia SDK 2.0 this code is working and why here is not. Ande there is another fact. I set the TextAreato editable, and it is not editable o_O