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: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

SystemDialog and SystemToast in Qml

Hello,
I want to use SystemDialog and SystemToast in my Cascade app.

Like said here https://developer.blackberry.com/cascades/documentation/ui/dialogs_toasts/sysdialogs.html,
I added LIBS += -lbbsystem in my .pro file but I'm asking about the following :

To use SystemDialog classes in Cascades, you must include the bb::system classes in your app header file. It is also a good idea to use the bb::system namespace so that you do not have to use fully qualified names in your code.

#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::system;

I'll use SystemDialog and SystemToast only in qml not C++. Do I have to include this in my app header file too ?

Thank you,
Laurent

Twitter : @LaurentKP
My apps
Developer
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free

Re: SystemDialog and SystemToast in Qml

[ Edited ]

You have to register your C++ class into the qml context to use them in qml . 

 

qmlRegisterType<SystemDialog>("my.library", 1, 0, "SystemDialog");

 

https://developer.blackberry.com/cascades/documentation/dev/integrating_cpp_qml/index.html

a lover of Qt
Developer
Posts: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Re: SystemDialog and SystemToast in Qml

Thank you but the SystemDialog documentation does not mention to add qmlRegisterType<SystemDialog>("my.library", 1, 0, "SystemDialog"); in C++

 

-->

You can also create aSystemDialogusing QML. Before you can create aSystemDialogin QML, you must import thebb.system 1.0library in your main.qml file.

 

I added import bb.system 1.0 in my main.qml file. I can show a SystemDialog, but I have trouble with SystemToast not showing...

 

 
 
Twitter : @LaurentKP
My apps
Highlighted
Developer
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free

Re: SystemDialog and SystemToast in Qml

Ah sorry, I didn't know ! So, thanks you for information ! Smiley Very Happy

 

So, you can try both and check which one works. 

Did you add LIBS += lbbsystem in your project.pro ? 

a lover of Qt
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: SystemDialog and SystemToast in Qml

 I can show a SystemDialog, but I have trouble with SystemToast not showing...

 

This is a known bug, they won't work together in current beta5 SDK:

http://supportforums.blackberry.com/t5/Cascades-Development/SystemDialog-onFinished-not-working-sinc...


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Re: SystemDialog and SystemToast in Qml

Ok I'll wait... For now I'll only use SystemDialog because it's more important for me.
Thank you guys !
Twitter : @LaurentKP
My apps