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
Highlighted
Regular Contributor
Posts: 83
Registered: ‎07-19-2012
My Device: Bold 9790, Dev Alpha A
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
}

 

 

 

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

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.

 


Andrey Fidrya, @zmeyc on twitter