10-02-2012 03:19 AM
Hello,
I am going through the updated docs and having issues implementing toasts.
void App::showToast() {
toast = new SystemToast(this);
toast->setBody("Welcome to the BlackBerry 10 Cascades documentation!" + "You have lots of space, but your text will wrap around in the dialog box.");
toast->show();
}
returns an error: "toast not declared in scope" on this line:
toast = new SystemToast(this);
I added all these header files to my name .cpp
#include <bb/system/SystemDialog> #include <bb/system/SystemListDialog> #include <bb/system/SystemPrompt> #include <bb/system/SystemCredentialsPrompt> #include <bb/system/SystemToast> #include <bb/system/SystemUiButton> #include <bb/system/SystemUiInputField> #include <bb/system/SystemUiError> #include <bb/system/SystemUiInputMode> #include <bb/system/SystemUiModality> #include <bb/system/SystemUiPosition> #include <bb/system/SystemUiResult> using namespace bb::cascades; using namespace bb::system;
my .pro includes these:
LIBS += -lbbdata -lbbsystem
my app.hpp header file looks like this
// List with context menu project template
#ifndef App_HPP_
#define App_HPP_
#include <QObject>
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() {}
void showToast();
};
#endif /* App_HPP_ */
Having a blast figuring out why its not working. Any of you have a working sample that connects everything to show a simple toast?
Thanks ![]()
Solved! Go to Solution.
10-03-2012 12:33 AM
I guess you missed variable declaration.
Declare a SystemToast object either in method itself or in app.hpp like this:
SystemToast *toast;
Regards,
Nishant Shah
10-03-2012 01:03 AM
There was a typo in the docs.
10-03-2012 09:00 AM
10-03-2012 04:23 PM
Someone forgot to include
SystemToast *
02-17-2013 04:44 AM - edited 02-17-2013 04:52 AM
Hi guys,
I'm getting this error (invalid use of 'this' in non-member function). I have .hpp and .pro files same as above, and method looks like this:
void App::showToast() {
SystemToast *toast = new SystemToast(this);
toast->setBody("blablabla ");
toast->show();
}