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
New Contributor
nostromofire
Posts: 9
Registered: ‎06-23-2013
My Device: Z10
Accepted Solution

Trying to get ListScrollStateHandler::onAtBeginningChanged(bool) to work.

I'm using the  10.1.0.1020 SDK

 

What I'm trying to do is have an infinite scroll both up and down so I need to detect when im trying to go beyond the current top and current bottom.  I've been trying to set the onAtBeginningChanged signal but in the log file it says this:

 

Warning: Object::connect: No such signal bb::cascades::ListScrollStateHandler::smileysurprised:nAtBeginningChanged(bool)

 

If it doesn't exist why does it compile without any errors?

 

All the other signals i've tried work ok, I have them in the code like this:

 

    ListScrollStateHandler::create(myListView).onAtEndChanged                (this, SLOT(myListAtEnd(bool)));
    ListScrollStateHandler::create(myListView).onAtBeginningChanged    (this, SLOT(myListAtStart(bool)));
    ListScrollStateHandler::create(myListView).onScrollingChanged          (this, SLOT(myListScrolling(bool)));
    ListScrollStateHandler::create(myListView).onFirstVisibleItemChanged  (this, SLOT(myListFirstItem(QVariantList)));

 

 

Also, (slightly related) is there any difference with the following:

 

LIstView *myList = LilstView::create();

 

and

 

ListView *myList = new ListView();

Please use plain text.
Developer
saprykin
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10

Re: Trying to get ListScrollStateHandler::onAtBeginningChanged(bool) to work.

It tries to connect to wrong signal: onAtBeginningChanged(bool) instead of atBeginningChanged (bool). Try to connect them manually using connect() method.
Connection is a runtime operation, so your code is compiled well.
Regarding object creation: in first case you are creating a new object and can tune additional parameters on the fly, in second case you are just creating a new object.
-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Please use plain text.
New Contributor
nostromofire
Posts: 9
Registered: ‎06-23-2013
My Device: Z10

Re: Trying to get ListScrollStateHandler::onAtBeginningChanged(bool) to work.

I have tried the following:

 

connect (myListView, SIGNAL (atBeginningChanged(bool)), this, SLOT (myListAtStart(bool)));

 

But this created an error in the debug file similar to before.

 

I also tried to use the connect with one of the signals I knew worked the onAtEndChanged.

I tired 2 ways:

 

   connect (myListView, SIGNAL (onAtEndChanged(bool)), this, SLOT (myListAtEnd(bool)));

 

then

 
   connect (myListView, SIGNAL (atEndChanged(bool)), this, SLOT (myListAtEnd(bool)));

 

Both caused errors in the debug file. e.g..

 

Warning: Object::connect: No such signal bb::cascades::ListView::smileysurprised:nAtEndChanged(bool) in src/applicationui.cpp:158

 

Am I not connecting correctly?

Please use plain text.
New Contributor
nostromofire
Posts: 9
Registered: ‎06-23-2013
My Device: Z10

Re: Trying to get ListScrollStateHandler::onAtBeginningChanged(bool) to work.

I have also tried this:

 

  ListScrollStateHandler *lssh = new ListScrollStateHandler();
  lssh->create(myListView);

  connect (lssh, SIGNAL (atEndChanged(bool)), this, SLOT (myListAtEnd(bool)));
  connect (lssh, SIGNAL (atBeginningChanged(bool)), this, SLOT (myListAtStart(bool)));

I don't get warnings in my debug anymore but the events are not triggered.

 

Please use plain text.
Developer
saprykin
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10

Re: Trying to get ListScrollStateHandler::onAtBeginningChanged(bool) to work.

Yes, your second attempt is right: signals are emited by ListScrollStateHandler object. That's why you are not seeing warnings anymore.
Now try the following code:

ListScrollStateHandler *lssh = new ListScrollStateHandler(myListView);

connect (lssh, SIGNAL (atEndChanged(bool)), this, SLOT (myListAtEnd(bool)));
connect (lssh, SIGNAL (atBeginningChanged(bool)), this, SLOT (myListAtStart(bool)));

 

 

-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Please use plain text.
New Contributor
nostromofire
Posts: 9
Registered: ‎06-23-2013
My Device: Z10

Re: Trying to get ListScrollStateHandler::onAtBeginningChanged(bool) to work.

Thanks for the help. 

 

Just out of curiosity, how did you work out that the ListScrollStateHandler onAtBeginningChanged was connecting to the wrong thing? Could I have worked this out for myself somehow or did you read it somewhere?

Please use plain text.
Developer
saprykin
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10

Re: Trying to get ListScrollStateHandler::onAtBeginningChanged(bool) to work.

Glad to hear it works mow :smileyhappy:
First, you can always check which signals object has using documentation: https://developer.blackberry.com/cascades/reference/bb__cascades__listscrollstatehandler.html#functi...
Here you can find all signals that ListScrollStateHandler has.
Second, read carefully documentation. Documentation for the ListScrollStateHandler says, that it listens ListView and emits signals on scroll changing. So, ListScrollStateHandler object must be pointed out which ListView object to listen - and it can be done right in constructor.
That's all. The documentation is a key for understanding and developing :smileyhappy:
-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Please use plain text.