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
bcs925
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30
My Carrier: T-Mobile

Re: Example of using Active Frames?

MedNez any update on posting this example?
---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan
Please use plain text.
New Developer
MedNez
Posts: 67
Registered: ‎11-24-2008
My Device: Not Specified

Re: Example of using Active Frames?

I've signed the contribution agreement and the code is with BB to commit. If it's not up in the next day or two I'll upload it somewhere else temporarily!

Please use plain text.
Developer
raffi
Posts: 154
Registered: ‎06-23-2012
My Device: Z10 & Z30
My Carrier: Bell

Re: Example of using Active Frames?

Any news on getting this example posted? I don't see it on the samples page even now...
Please use plain text.
New Developer
MedNez
Posts: 67
Registered: ‎11-24-2008
My Device: Not Specified

Re: Example of using Active Frames?

Long story short - I couldn't quite work out how to push my changes to Github.

 

Sorry about the delay, here is a link! :smileyhappy:

 

http://www.filedropper.com/helloscenecover

Please use plain text.
New Developer
wilochoa14
Posts: 12
Registered: ‎10-15-2012
My Device: Dev Alpha 10
My Carrier: MOVILNET

Re: Example of using Active Frames?

Hi men ,look this link

 

http://devblog.blackberry.com/2012/11/bbm-invocation-framework/

 

here is a active frames

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Example of using Active Frames?

wilochoa14, what are you talking about? That link goes to a page on BBM and the invocation framework. It has nothing to do with active frames.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Trusted Contributor
georg22
Posts: 245
Registered: ‎11-22-2011
My Device: Blackberry Playbook
My Carrier: vodafone

Re: Example of using Active Frames?

Hi,

 

the example in this thread did not work for me, i dont know why. But the following worked fine and its very easy to change the content of the SceneCover because "Application.cover" is a reference to this component.

 

AppCover.qml:

 

import bb.cascades 1.0

SceneCover {

    property alias extraText: testText.text
    
    content: Container {
        Container {
            layout: DockLayout {
            }
            background: Color.Black
             Label {
                  id: testText
                  horizontalAlignment: HorizontalAlignment.Center
                  verticalAlignment: VerticalAlignment.Center
                  text: "Intital Text"
                  textStyle.color: Color.create("#ebebeb")
            }
        }
    }
}

 

 

in main.qml

    onCreationCompleted: {
        Application.cover = appCover.createObject();
        Application.cover.extraText = "Changed Text"
    }
    //

    attachedObjects: [
        ComponentDefinition {
            id: appCover
            source: "AppCover.qml"
        }
    //
Please use plain text.
New Developer
MedNez
Posts: 67
Registered: ‎11-24-2008
My Device: Not Specified

Re: Example of using Active Frames?

Please use plain text.
Contributor
TheStoof
Posts: 20
Registered: ‎02-21-2012
My Device: Bold 9900
My Carrier: AT&T

Re: Example of using Active Frames?

[ Edited ]

This might be an old thread, but I did figure it out.

 

In main.cpp, you can use 'app.setCover(new ActiveFrame());' or you can do it else. Do it here. Makes sense!

 

Second,

 

// ActiveFrame.cpp

#include "ActiveFrame.hpp"

ActiveFrame::ActiveFrame() :SceneCover(this) {

    // Load the QML for the cover and retrieve the root container
    qml = QmlDocument::create("asset:///screenCover.qml").parent(this);
    mMainContainer = qml->createRootObject<Container>();

    // Set the content of ActiveFrame
    setContent(mMainContainer);

    // Trigger an initial update of the content
    update();
}

ActiveFrame:: ~ ActiveFrame() {

}

void ActiveFrame::update() {

    // ...Here's where you update the cover...

    // You can trigger updates here as often as necessary
}

 

// ActiveFrame.hpp

#ifndef ACTIVEFRAME_HPP_
#define ACTIVEFRAME_HPP_

#include <bb/cascades/SceneCover>
#include <bb/cascades/Container>
#include <bb/cascades/QmlDocument>

using namespace bb::cascades;

namespace bb {
	namespace cascades {

		class Container;
		class QmlDocument;
		class QObject;

	}
}

class ActiveFrame : public SceneCover {
	Q_OBJECT

public:
    ActiveFrame();
    virtual ~ActiveFrame();

private:
    Container *mMainContainer;
    QmlDocument *qml;


};



#endif /* ACTIVEFRAME_HPP_ */

 Now, the QML is important. If you're coming from the QML example, you probably used "SceneCover {}". That was my problem!

 

Essentially, you're creating the SceneCover by new ActiveFrame() then calling the QML to load the Container{}. *NOTE* - You can't wrap this in a Page{}. Just tried it.

 

So pop in the import tag then Container{} into your screenCover.qml and you're done.

 

Mess around with this some more and you can get the signals to work :smileyhappy:.

Please use plain text.