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
Regular Contributor
CrozyBB
Posts: 83
Registered: ‎07-19-2012
My Carrier: Koodo
Accepted Solution

Custom Buttons for System Dialog in C++

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
}

 

 

 

Please use plain text.
Developer
Zmey
Posts: 916
Registered: ‎12-18-2012

Re: Custom Buttons for System Dialog in C++

[ Edited ]
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/reference/bb__system__systemuiresult.html

 

Probably it's better to swap the labels around.

 

Please use plain text.