CTestMenu: add sample for hintbox with timeout

This commit is contained in:
2016-11-10 00:50:13 +01:00
parent 0952efaba4
commit 43c1349ffa

View File

@@ -817,27 +817,19 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
else if (actionKey == "footer_key"){ else if (actionKey == "footer_key"){
neutrino_msg_t msg; CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, "Footer-Key pressed. Press EXIT to return", 350, NULL, NULL, CComponentsHeader::CC_BTN_EXIT);
neutrino_msg_data_t data; hintBox.setTimeOut(15);
CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, "Footer-Key pressed. Press EXIT to return", 350, NULL, NULL, CComponentsHeader::CC_BTN_EXIT);
//optional: it is also possible to add more items into the hint box //optional: it is also possible to add more items into the hint box
//here some examples: //here some examples:
hintBox->addHintItem(new CComponentsShapeSquare(CC_CENTERED, CC_APPEND, 330, 2, NULL, false, COL_MENUCONTENT_PLUS_6, COL_RED)); hintBox.addHintItem(new CComponentsShapeSquare(CC_CENTERED, CC_APPEND, 330, 2, NULL, false, COL_MENUCONTENT_PLUS_6, COL_RED));
hintBox->addHintItem("- text with left icon", CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, NEUTRINO_ICON_HINT_INFO); hintBox.addHintItem("- text with left icon", CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, NEUTRINO_ICON_HINT_INFO);
hintBox->addHintItem("- text right without an icon", CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH | CTextBox::RIGHT); hintBox.addHintItem("- text right without an icon", CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH | CTextBox::RIGHT);
hintBox->addHintItem("- text right with an icon", CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH | CTextBox::RIGHT, NEUTRINO_ICON_HINT_INFO); hintBox.addHintItem("- text right with an icon", CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH | CTextBox::RIGHT, NEUTRINO_ICON_HINT_INFO);
hintBox->paint(); hintBox.paint();
while (1) res = hintBox.exec();
{ hintBox.hide();
g_RCInput->getMsg(&msg, &data, 100);
if (msg == CRCInput::RC_home)
hintBox->hide();
break;
}
hintBox->hide();
delete hintBox;
return res; return res;
} }