c++ - BlackBerry 10 - Dialog Box -
i m developing 1 app contact reading . in contact adding page have created textfields first name n last name , phone number etc. , have created 1 actionitem save or create contact . this
acceptaction: actionitem { title: (_contactread.contacteditor.mode == contacteditor.createmode ? qstr ("create" ) : qstr ("save")) ontriggered: { _contactread.contacteditor.savecontact() navigationpane.pop() } }
i want display pop (dialog box or toast) when click on save or create contact. tried add open() in ontriggered confused how , create dialog box.
please me out....
use --> alert(tr("contact saved"));
refer following sample
-----------qml--------------
button { horizontalalignment: horizontalalignment.center text: qstr("update") onclicked: { _app.updaterecord(idupdatetextfield.text, firstnameupdatetextfield.text, lastnameupdatetextfield.text); } }
-----------------cpp file-------------------
bool app::updaterecord(const qstring &customerid, const qstring &firstname, const qstring &lastname) { bool intconversiongood = false; const int customeridkey = customerid.toint(&intconversiongood); if (!intconversiongood) { alert(tr("you must provide valid integer key.")); return false; } qsqldatabase database = qsqldatabase::database(); qsqlquery query(database); const qstring sqlcommand = "update customers " " set firstname = :firstname, lastname = :lastname" " customerid = :customerid"; query.prepare(sqlcommand); query.bindvalue(":firstname", firstname); query.bindvalue(":lastname", lastname); query.bindvalue(":customerid", customeridkey); bool updated = false; if (query.exec()) { if (query.numrowsaffected() > 0) { alert(tr("customer id=%1 updated.").arg(customerid)); updated = true; } else { alert(tr("customer id=%1 not found.").arg(customerid)); } } else { alert(tr("sql error: %1").arg(query.lasterror().text())); } database.close(); return updated; }
Comments
Post a Comment