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: 165
Registered: ‎10-04-2010
My Device: P'9982 & Z10
My Carrier: alfa Lebanon
Accepted Solution

Pushed QML Page won't Scrol

I'm pushing a QML page like this:

var page = locationPage.createObject();
nav.push(page);

 I have textboxes, webviews, date selectors..., so they extend to more than what is visible. The page won't scroll though. What can I do?

 

I tried manually setting height for the Containers but that didn't help.

Wadi
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Pushed QML Page won't Scrol

[ Edited ]

Hi,
Put the content into Container and wrap it into ScrollView.

 

Page {
    ScrollView {
        Container {
          TextField { }
          Button { }
          ...
        }
    }
}

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 165
Registered: ‎10-04-2010
My Device: P'9982 & Z10
My Carrier: alfa Lebanon

Re: Pushed QML Page won't Scrol

Wow thanks! Perfect

Another quick question, I have a background for this container but sometimes it doesn't cover all the screen. Is there a way to tell it to have its height at full screen if it's less than the visible?
Wadi
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Pushed QML Page won't Scrol

[ Edited ]

This code kind of works, but has a visual glitch on rotation. Also white area will show through on bounce:

 

// Navigation pane project template
import bb.cascades 1.0

Page {
    ScrollView {
        preferredWidth: Infinity
        preferredHeight: Infinity
        attachedObjects: [
            LayoutUpdateHandler {
                id: topContainerLayoutHandler
            }
        ]
        Container {
            minHeight: topContainerLayoutHandler.layoutFrame.height
            background: Color.create("#00ff00")
            TextField {
            }
            TextField {
            }
        }
    }
}

Do you need the background to scroll? If not, you can wrap the scrollview into another container containing the background and set the container's preferredWidth & preferredHeight to Infinity. It won't stretch past the available space if it's not inside of scrollview.

 


Andrey Fidrya, @zmeyc on twitter