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
annadanesh
Posts: 82
Registered: ‎01-11-2013
My Device: DevAlphadevice

Issue wrt to systemdialogs

hi,

 

1>>how to create system dialog with only ok button in qml

 

2>>i am creating two dialogs with ok,cancel in app.cpp class,so how to handle different slots for both system dialogs separatly by giving different implemention in onDialogFinished slots function for cancel and ok buttons

 

 

am strugging to slove this issues so please any  one of you  know the solution plz reply me.

Please use plain text.
Developer
jalue
Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10

Re: Issue wrt to systemdialogs

[ Edited ]

Hey there..

 

1) You already found this post which has an example of setting the label for the cancelButton to undefined..

http://supportforums.blackberry.com/t5/Cascades-Development/How-to-remove-Cancel-button-in-SystemDia...

    cancelButton.label: undefined

 1a) In C++ you can also specify that you want only an Ok button by using:

    sysDialog = new SystemDialog("Ok", 0, this);

 

Using 0 (zero) to specify the Cancel button label.

 

2) Not entirely sure what you're asking here. Do you want to use 1 SLOT function to handle both SystemDialog objects? You won't be able to distinguish between both SystemDialogs unfortunately, because the 

bb::system::SystemUiResult::Type

only specifies what button the user pressed if any or whether there was an error within a specific SystemDialog... There doesn't seem to be a way of telling if it was SystemDialog 1 or 2 ... Therefore you need to use 2 separate connect() and 2 separate SLOT functions...

// Be sure to have these 2 statements at the beginning of your CPP file.
#include <bb/system/SystemUiResult>
using namespace bb::system;

res = connect(sd1, SIGNAL(finished(bb::system::SystemUiResult::Type)), this, SLOT(onDialog1Finished(bb::system::SystemUiResult::Type))); res = connect(sd2, SIGNAL(finished(bb::system::SystemUiResult::Type)), this, SLOT(onDialog2Finished(bb::system::SystemUiResult::Type)));

 

And then within each SLOT function you can have something like:

void yourClass::onDialog1Finished(bb::system::SystemUiResult::Type uiResult) {
    // This is the first Dialog
    if (uiResult == SystemUiResult::ConfirmButtonSelection) {
        // User pressed Okay/Confirm button
    } else if (uiResult == SystemUiResult::CancelButtonSelection) {
        // User pressed Cancel button
    }
}

 

Please use plain text.
Developer
annadanesh
Posts: 82
Registered: ‎01-11-2013
My Device: DevAlphadevice

Re: Issue wrt to systemdialogs

thks for ur response,

 

1>>i tried by adding  cancelButton.label: undefined in qml its giving invalid property error even i included  #include <bb/system/SystemDialog> this in cpp file

 

2>>second one working fine,but i have one more issue,ie : when i click ok am closing app, but when i click cancel i want my app to be continued,but nw when i click cancel it is there in be first screen(splashscreen) (qml) ony ,where i am running timer in which i am  creating dynamic page as attachedobeject as second screen

 

 

so please reply me

Please use plain text.
Developer
jalue
Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10

Re: Issue wrt to systemdialogs

Hey again

 

1) Did you put it within the SystemDialog { } area in your QML file?

 

2) Not quite sure what you're explaining..  Can you explain it again?  Sorry...

Please use plain text.
Developer
annadanesh
Posts: 82
Registered: ‎01-11-2013
My Device: DevAlphadevice

Re: Issue wrt to systemdialogs

Hi,

 

I am using total 3 systemdialogs,ie 2 dialogs in c++ class,1 dialog in qml file so my issues are

 

1>>as am using 1 systemDialog in qml it is having both ok and cancel button but i need only ok button so used ur reply code ie:cancelButton.label:undefined but is giving error invalid property error

 

2>> in c++ class for 1 systemdialog  on press of ok,i am closing app,onclick of cacel buttton i want app to be continue

 

so plz reply me

Please use plain text.
Developer
jalue
Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10

Re: Issue wrt to systemdialogs

[ Edited ]

In the link I gave, did you read 's post?  He gave an example of cancelButton.label: undefined there...

http://supportforums.blackberry.com/t5/Cascades-Development/How-to-remove-Cancel-button-in-SystemDia...

Although there seems to be a problem with using 'undefined' when you are using 10.1 as this post states...

http://supportforums.blackberry.com/t5/Cascades-Development/How-to-remove-default-cancel-button-from...

 

For #2, you can do this in your SLOT function...

void yourClass::onDialog1Finished(bb::system::SystemUiResult::Type uiResult) {
    // This is the first Dialog
    if (uiResult == SystemUiResult::ConfirmButtonSelection) {
        // User pressed Okay/Confirm button
        // To exit your app, you use the following:
        Application::instance()->requestExit();
    } else if (uiResult == SystemUiResult::CancelButtonSelection) {
        // User pressed Cancel button
        // You can do nothing here and your app will continue...
    }
}

 

Please use plain text.