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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
New Member
Vegetto
Posts: 1
Registered: ‎12-27-2012
My Carrier: Nobody

General QML and cascades development questions

I'm a newbie, so forgive me if I'm asking questions already present in one of your resources.

 

Firstly, where can I find the header for the App class? One of the examples state that you can write the following code:

void App::handleTouch()
{
    colorContainer->setBackground(Color::Green);
}
 
For this, I should declare the handleTouch() in the App header file. Where do I add this? Should I create new app.cpp and app.hpp files myself? Basically, I wanted to expose a few signal handlers across my application. Is this the right way to go?
 
Secondly, I would like to have a generic button click handler. If I pass "this" in my "onClicked" signal, it sends the function reference (my guess), how do I send a pointer to the button to my C++ function?
 
Thank you :smileyhappy:
Please use plain text.
Contributor
paiki
Posts: 29
Registered: ‎01-18-2011

Are you trying an App Sample?     App:: is the class that...

Are you trying an App Sample?

 

 

App:: is the class that you create, normally I do that:

 

I'll create an App called PlasticEraser

 

So I create two files:

 

PlasticEraser.cpp

#include "PlasticEraser.hpp"

PlasticEraser::PlasticEraser() {
	// TODO Auto-generated constructor stub

}

PlasticEraser::~PlasticEraser() {
	// TODO Auto-generated destructor stub
}

 

and PlasticEraser.hpp

#ifndef PLASTICERASER_HPP_
#define PLASTICERASER_HPP_

class PlasticEraser {
public:
	PlasticEraser();
	virtual ~PlasticEraser();
};

#endif /* PLASTICERASER_HPP_ */

 

In your case, your class APP, have a function called handleTouch(), guessing the name, you want a SLOT to handle a TouchEvent.

 

you should have inside your App.hpp something like this:

#ifndef APP_HPP_
#define APP_HPP_


#include <bb/cascades/TouchEvent>

class App {
public:
	App();
	virtual ~App();
	
private slots:
	void handleTouch(TouchEvent* reply);
};

#endif /* APP_HPP_ */

 

 

Please use plain text.