Hi,

I solved it by slightly digging in the method calls to see if there was a 
way to deviate how things were handled. Found that when a component gets 
called, the method scrollComponentToVisible() is called. So since my 
textarea is inside the form's layered pane, what I did was to override that 
method:

@Override
    public void scrollComponentToVisible(Component c) {
        if (!this.getLayeredPane().contains(c)){
            super.scrollComponentToVisible(c);
        }
    }

Now, when this method is called for a control in the form's layered pane, 
the form won't update its scroll position. And this works.

If there's a better way to solve it please advise.

Thanks in advance.

Carlos.

El viernes, 7 de junio de 2019, 10:54:27 (UTC+2), [email protected] 
escribió:
>
> Hi there,
>
> I am developing a short chat application. My layout structure is a 
> BoxLayout.y() for the form where I append each of the message containers, 
> and then in the layeredpane of the form, via 
> a BoxLayout(BoxLayout.Y_AXIS_BOTTOM_LAST), I include the input pane to 
> enter the message text and the send message button. So far so good, and 
> everything works smoothly. 
>
> When we get to fully occupy the area of appended messages and overflow the 
> available area of the form, the expected behaviour is to expand the 
> container, and enable navigation via vertical scrolling. A behaviour 
> requirement is aswell to scroll to the bottommost message when new messages 
> are appended. So far so good. 
>
> The point is that when we are at the bottom of the container in the scroll 
> position, when the TextArea control of the inputpane gains focus, the 
> scroll position of the form gets screwed and the form turns to the top 
> position of the scrolling, hence displaying the first appended message 
> instead of the last.
>
> Since this seems to be a default behaviour can't figure out how to 
> approach a solution. I have tried to apply the same logic as to when new 
> messages are appended with no luck.
>
>
> Does anyone have an idea how to solve it?
>
> Regards and thanks for your time.
>
> Carlos.
>
>
>

-- 
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/8dd4ab64-8d0d-43a0-91af-0406bb627da2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to