Did you revalidate/repaint?
When changing a UI you need to refresh when you're done. Codename One
doesn't auto-reflow.
On Tuesday, January 5, 2021 at 10:49:36 AM UTC+2 P5music wrote:
> Yes, you are right. I checked and it is not matter of events being called
> or not.
> The setEdited() method in fact sets the icon of the save button.
> This icon is different according to the saved or unsaved state of the
> editing container.
> If the data are unsaved the icon changes to represent a reminder for the
> user, although the user will be asked to save anyway.
>
> So the issue is in the setIcon method.
> The icons are created in Java code (Flamingo).
> The complete call is
> setIcon(buttonIcon.scaled(doubleButtonSize,doubleButtonSize).toImage());
> This could be a matter of UI refresh, like it happens for the
> BrowserComponent (it has to be "touched" to update the content or the
> appearance).
> Regards
> Il giorno martedì 5 gennaio 2021 alle 04:14:00 UTC+1 Shai Almog ha scritto:
>
>> Data changed is invoked as you type in the simulator too. Not sure what
>> you're seeing here...
>>
>> On Monday, January 4, 2021 at 1:22:39 PM UTC+2 P5music wrote:
>>
>>> My CodenameOne app features a container for editing. It contains some
>>> TextFields, Buttons and other components.
>>> I need to know when the text has changed inside a TextField, but I see
>>> that the listener is called only after another component has been focused.
>>>
>>> editText.addDataChangedListener(new DataChangedListener() {
>>> @Override
>>> public void dataChanged(int type, int index) {
>>> setEdited();
>>> }
>>> });
>>>
>>> This method is called
>>>
>>> public void setEdited()
>>> {
>>> // System.out.println("edited"); event not fired
>>> System.out.println("edited"); event fired
>>> ...
>>> ...
>>>
>>> }
>>>
>>> In the method you can see that a logging instruction is present.
>>> If it is present the event is fired.
>>> If it is commented the event is not fired.
>>>
>>> Is this a behaviour that will be found also on devices?
>>> Or it is just one of simulator's whims?
>>>
>>> Thanks in advance
>>>
>>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/6b952d7c-7789-484e-b512-5e775fbcfd3fn%40googlegroups.com.