I see you can detect losing focus using this:

 etAnswer.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                _("LOST FOCUS");
                textFieldOnFocusChanged( "TEXTFIELD", question,  etAnswer,  
etAnswer.hasFocus(),  detailCounter,  details);
            }
        });

is there also a way to force losing focus using in code?

in the port im doing the android code uses

tf.clearFocus() to call some logic, Im wondering if I can do this in 
codename one ?


On Thursday, March 1, 2018 at 6:49:22 PM UTC+8, Gareth Murfin wrote:
>
> I need to use a focusListener on some textfields, but the problem is when 
> focusGained or focusLost is called most of the time the value in the 
> textfield is wrong. 
>
> For example: 
>
> lets say i type hello then leave the textfield 
>
>   etAnswer.addFocusListener(new FocusListener(){  
>             @Override
>             public void focusGained(Component cmp) {
>                       system.out.println("etAnswer conents->"+etAnswer);// 
> this will *not* show hello everytime, even a uitimer with delay will not, 
> even cmp itself will not!
>             }
>
> Any thoughts?
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/190a18e6-b16e-42dc-a227-a034c10787e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to