12-28-2012 07:46 PM
I've been able to create a simple system dialog with two buttons -> "yes" and "no". I followed the example code shown here. What code can I use to determine if "yes" or "no" is selected by the user?
SystemDialog *dialog = new SystemDialog("No", "Yes");
dialog->setTitle("Age Verification");
bool success = connect(dialog, SIGNAL(finished(bb::system::SystemUiResult::Type)) , this, SLOT(onAgeVerify(bb::system::SystemUiResult::Type) ));
if (success) {
dialog->show();
} else {
dialog->deleteLater();
}SLOT:
void MyApp::onAgeVerify(bb::system::SystemUiResult::Type type) { //if 'yes' is selected //unknown code //else if 'no' is selected //unknown code }
Solved! Go to Solution.
12-28-2012 07:54 PM - edited 12-28-2012 08:04 PM
SystemDialog (const QString &confirmLabel, const QString &cancelLabel, QObject *parent=0)
So 'No' is confirmLabel and 'Yes' is cancelLabel.
if (type == SystemUIResult::ConfirmButtonSelection)
{
qDebug() << "No\n";
}
else if (type == SystemUIResult::CancelButtonSelection)
{
qDebug() << "Yes\n";
}Take a look at SystemUIResult docs for a list of possible values:
https://developer.blackberry.com/cascades/referenc
Probably it's better to swap the labels around.