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
Developer
meego_man
Posts: 189
Registered: ‎11-25-2012
My Device: BlackBerry Dev Alpha B

Cascades for MeeGo developers

Hi,

 

   I'm new to Cascaded with previous experience in MeeGo Qt/QML development. Currently I'm trying to port few apps to BlackBerry 10 platform with is great, but having lots of difficulties due to the fact that Cascades uses modified version of QML. Would it be possible to keep this thread for all of MeeGo developers who struggle as me with simple things in Cascades? Thank you in advance.

 

My first question is very simple, how do I pragmatically scroll to an item in ListView? I did read the documentation, and also used google, but got no answer. I know there is a method scrollToItem, but I cannot figure it out what should I pass to indexPath argument. Tried using simple index (int value that specifies the index of the item in the list) but without any success. Here is the code that misses arguments for scrollToItem method:

 

import bb.cascades 1.0

Container {
    layout: StackLayout {}
    ListView {
        id: valueSelector;
        verticalAlignment: VerticalAlignment.Fill;
        horizontalAlignment: HorizontalAlignment.Fill;
        dataModel: ArrayDataModel {
            id: arrayModel;
            
        }
    }
    
    onCreationCompleted: {
        for (var i=0; i<100; i++)
            arrayModel.append (i);
        valueSelector.scrollToItem ();
    }
}

 Thank you in advance for your help

Please use plain text.
New Developer
New Developer
rzr
Posts: 151
Registered: ‎01-05-2010
My Device: dev alpha c (bb10)
My Carrier: www.rzr.online.fr
Please use plain text.
Developer
meego_man
Posts: 189
Registered: ‎11-25-2012
My Device: BlackBerry Dev Alpha B

Re: Cascades for MeeGo developers

rzr, thank you for your reply. I already used Symbian components on PlayBook and they work perfectly (at least those I used). My problem was Cascades that are not very similar to QML/QML components at all, despite the fact that both use the same engine. On MeeGo/Symbian we use QML components that are designed for corresponding platform and standard QML objects like ListView. What would be beneficial for MeeGo/Symbian Qt developers is to have some sort of mapping scheme from "standard" QML elements to Cascades. 

 

  I know that one can use standard Qt/QML on BB10 but then we loose the beauty of the platform and its capabilities, since QtGui (that is used by standard QML viewer) and Cascades cannot be mixed in one project :smileyhappy:

Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Cascades for MeeGo developers

Check out these 3 slots for your scrolling needs https://developer.blackberry.com/cascades/reference/bb__cascades__listview.html#scroll
Like all of my posts
Please use plain text.
Developer
hakimrie
Posts: 82
Registered: ‎07-23-2009
My Device: 9900
My Carrier: XL

Re: Cascades for MeeGo developers

afaik indexpath is just array (variant list)

you can try 

ScrollToItem([0, n], ScrollAnimation.Default); // for scroll to item header 1  and item index nth

 

 

Please use plain text.
New Contributor
JohnDaly
Posts: 8
Registered: ‎11-20-2012
My Device: BB10 dev alpha
My Carrier: Telekom

Re: Cascades for MeeGo developers

we use <your model name here>.scrollToItem(<your index path here>)

 

Please use plain text.
Developer
meego_man
Posts: 189
Registered: ‎11-25-2012
My Device: BlackBerry Dev Alpha B

Re: Cascades for MeeGo developers

Model? Oh, I'll try this method. 

Thank you all for your helpful replies 

Please use plain text.
New Contributor
JohnDaly
Posts: 8
Registered: ‎11-20-2012
My Device: BB10 dev alpha
My Carrier: Telekom

Re: Cascades for MeeGo developers

Sorry, I wrote model but meant list view

Please use plain text.
Developer
meego_man
Posts: 189
Registered: ‎11-25-2012
My Device: BlackBerry Dev Alpha B

Re: Cascades for MeeGo developers

I see :smileyhappy: 

Please use plain text.
Please use plain text.