Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper

Scrollview scrolling down itself

Hi all,

 

I have a strange behavior in my app.

I have a page with a Scrollview, in this scrollview there a Label, Webview, horizontal Listview.

When I make the page and assign value for each component sometimes the scrollView automatically scroll down...

It seems to be when there is a huge content in my webview (if there isn't a webview there isn't problem).

The content can change with a user action and then the scrollView scroll down too.

 

The strangest is that if I put the app in background and immediatly get it in frontground, the strange behavior doesn't occur anymore.

 

Anyone not this before ? Maybe something append when the app is backgrounded and foregrounded that fix this behavior.

 

I don't understand.

 

Thanks.

 

---------
Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Contributor
Posts: 10
Registered: ‎10-25-2011
My Device: bold
My Carrier: fido

Re: Scrollview scrolling down itself

Have you placed your webview directly within the scrollview, or is it placed within it's own container inside the scrollview. I noticed if the webview is placed within a seperate container inside the scrollview, it automatically scrolls to where the webview starts. However, if you place the webview directly in the scrollview without it being inside a seperate container, it seems to work properly. 

Developer
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper

Re: Scrollview scrolling down itself

Thanks for your interest.

No the webview is in a container, with label and other elements.

---------
Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Contributor
Posts: 10
Registered: ‎10-25-2011
My Device: bold
My Carrier: fido

Re: Scrollview scrolling down itself

So I'm guessing you have it placed like this?

    ScrollView

    {

        Container

        {

            Label

            {

             }

            Label

            {

             }

            Webview

            {

             }

       }

}

 

Developer
Posts: 410
Registered: ‎06-03-2010
My Device: Z10 Red
My Carrier: Free

Re: Scrollview scrolling down itself

I have the same structure that you guessed and the same problem. Does anyone has found a workaround ?

Developer
Posts: 64
Registered: ‎09-10-2009
My Device: Z10, Bold 9700
My Carrier: O2 Germany

Re: Scrollview scrolling down itself

I just noticed the same problem with my WebView. If anyone knows of any solution, I'd be glad to know.
----

My Twitter: @hendrik_dev
Contributor
Posts: 14
Registered: ‎06-01-2011
My Device: BlackBerry Q10
My Carrier: Three UK

Re: Scrollview scrolling down itself

[ Edited ]

Figured out a workaround... not sure if it will always work or why, but it works for me; 

 

I had a webview loading local HTML so I made it visible:false, and intercepted onNavigationRequested. In this, I then made it visible. So basically, it becomes visible after its already loaded and is loading new content. as onNavigationRequested is called even for the initial content load

 

Hopefully might help someone, or lead to a better solution. 

 

                        onNavigationRequested: {
                           
                            var thisUrl = request.url.toString(); 

                            if(thisUrl.indexOf("http") > -1) {
                                request.action = WebNavigationRequestAction.Ignore
                            }
                            else {
                                myWebView.visible = true; 
                            }
                        }