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
Posts: 887
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha

Example of using Active Frames?

The documentation of how to create the active frames is a bit lacking. (https://developer.blackberry.com/cascades/reference/bb__cascades__application.html#setcover) does anyone know of any Cascades examples that make use this feature? The only example I have been able to find is in AIR.

 

So far whenever I try to listen for onThumbnail() the application fails to launch properly...

 

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 572
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: Example of using Active Frames?

Hi!

 

I was able to get onThumbnail() to work properly. Check out my code.

Basically I connected the signal and slot to a class function. This function is called every time thumbnail signal is emitted.

Code

 

app.cpp

App::App(bb::cascades::Application *app)
: QObject(app)
{
    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole application lifetime
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    qml->setContextProperty("app", this);

        if (!qml->hasErrors())
         {
           AbstractPane *root = qml->createRootObject<AbstractPane>();
           if (root)
           {

        	 QObject::connect(app, SIGNAL(thumbnail()), this, SLOT(onThumbnail()));
             Application::instance()->setScene(root);
           }
         }
}
void App::onThumbnail() { // run your code here // setCover() etc. // this is triggered every time app gets put into thumbnail view // ideal for ActiveFrames }


 
app.hpp

 

#ifndef App_HPP_
#define App_HPP_

#include <QObject>
#include <bb/cascades/Application>
#include <bb/cascades/controls/container.h>
#include <bb/Application>
#include <bb/cascades/AbstractCover>


namespace bb { namespace cascades { class Application; }}

/*!
 * @brief Application pane object
 *
 *Use this object to create and init app UI, to create context objects, to register the new meta types etc.
 */
class App : public QObject
{
    Q_OBJECT
public:
    App(bb::cascades::Application *app);
    virtual ~App() {}
public Q_SLOTS:
    void onThumbnail();
};

#endif /* App_HPP_ */

 
I added 

public Q_SLOTS:
    void onThumbnail();

 to the header.


Rock on!
:Rockon:




Developer
Posts: 304
Registered: ‎08-14-2012
My Device: PlayBook, Z10, Dev C

Re: Example of using Active Frames?

Just to understand what the op is doing or trying to do.

 

The active frame when the app is minimize correct and this can only be done with C++ not in qml

Is this code universal and works in all app situation. thanks in advance

BlackBerry 10 game reviews for the unknown, small and indie developers. Little games with big dreams. VeryBerryGames.com | Follow @VeryBerryGames | TwoCasualCoders.com | never casual on quality
Developer
Posts: 887
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha

Re: Example of using Active Frames?

The documentation hints that a QML approach is possible, but I have yet to get that to work. In fact all of the documentation on this feature is very incomplete (and in some cases, simply wrong). So really nobody has a clue.

 

The above c++ code works simply enough for listening for when the app is thumbnailed, but I have yet to figure out how to acutally set the cover image...

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: Example of using Active Frames?

[ Edited ]

Check out these docs... active frames = cover and can be set from qml. This is a property of the application singleton so you should be able to edit it in qml by doing something like Application.cover = someattachedobject or somethin

 

https://developer.blackberry.com/cascades/reference/bb__cascades__scenecover.html

https://developer.blackberry.com/cascades/reference/bb__cascades__application.html#setcover

Like all of my posts
Developer
Posts: 71
Registered: ‎09-19-2012
My Device: Z10 very soon

Re: Example of using Active Frames?

Hi all

 

I have working an example of ActiveFrame.  

 

Can somebody tell me how to add attachments to the posts ? :Innocent:

Developer
Posts: 304
Registered: ‎08-14-2012
My Device: PlayBook, Z10, Dev C

Re: Example of using Active Frames?

There should be a C for code and enter in there with a folder second last icon top row
BlackBerry 10 game reviews for the unknown, small and indie developers. Little games with big dreams. VeryBerryGames.com | Follow @VeryBerryGames | TwoCasualCoders.com | never casual on quality
Developer
Posts: 887
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha

Re: Example of using Active Frames?


igosoft wrote:

Hi all

 

I have working an example of ActiveFrame.  

 

Can somebody tell me how to add attachments to the posts ? :Innocent:


Probably easiest to just post a link to the file elsewhere...

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 71
Registered: ‎09-19-2012
My Device: Z10 very soon

Re: Example of using Active Frames?

[ Edited ]

 

Yes. There is C icon but I can only paste the source code there is no a place where I can select a file to attach

 

I uploaded ActiveFrame example project on Goodle Drive.

 

https://docs.google.com/folder/d/0B6Z6HLwhJG97UzRvMVZJMUpIUnc/edit

 

 

Developer
Posts: 304
Registered: ‎08-14-2012
My Device: PlayBook, Z10, Dev C

Re: Example of using Active Frames?

thanks for the contribution ill test it out tonight.

BlackBerry 10 game reviews for the unknown, small and indie developers. Little games with big dreams. VeryBerryGames.com | Follow @VeryBerryGames | TwoCasualCoders.com | never casual on quality