本文整理汇总了C++中CDialog::Run方法的典型用法代码示例。如果您正苦于以下问题:C++ CDialog::Run方法的具体用法?C++ CDialog::Run怎么用?C++ CDialog::Run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDialog
的用法示例。
在下文中一共展示了CDialog::Run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InputBox
std::string InputBox(const std::string &msg, const std::string &init, int max, chtype out)
{
CDialog *dialog = CreateBaseDialog(TColorPair(COLOR_GREEN, COLOR_BLUE),
TColorPair(COLOR_WHITE, COLOR_BLUE), 50);
CLabel *label = new CLabel(msg, false);
label->SetMaxReqWidth(MaxW());
dialog->AddWidget(label);
CInputField *input = new CInputField(init, CInputField::STRING, max, out);
dialog->StartPack(input, true, true, 1, 0);
CButton *okbutton = new CButton(GetTranslation("OK")), *cancelbutton = new CButton(GetTranslation("Cancel"));
dialog->AddButton(okbutton, false, false);
dialog->AddButton(cancelbutton, false, false);
TUI.AddGroup(dialog, true);
while (dialog->Run())
;
std::string ret;
if (dialog->ActivatedWidget() != cancelbutton)
ret = input->Value();
delete dialog;
return ret;
}
示例2: WarningBox
void WarningBox(const std::string &msg)
{
CDialog *dialog = CreateBaseDialog(TColorPair(COLOR_YELLOW, COLOR_RED),
TColorPair(COLOR_WHITE, COLOR_RED), 30, 0, msg);
dialog->AddButton(new CButton(GetTranslation("OK")));
TUI.AddGroup(dialog, true);
while (dialog->Run())
;
delete dialog;
}
示例3: MessageBox
void MessageBox(const std::string &msg)
{
CDialog *dialog = CreateBaseDialog(TColorPair(COLOR_GREEN, COLOR_BLUE),
TColorPair(COLOR_WHITE, COLOR_BLUE), 25, 0, msg);
dialog->AddButton(new CButton(GetTranslation("OK")));
TUI.AddGroup(dialog, true);
while (dialog->Run())
;
delete dialog;
}
示例4: YesNoBox
bool YesNoBox(const std::string &msg)
{
CDialog *dialog = CreateBaseDialog(TColorPair(COLOR_GREEN, COLOR_BLUE), TColorPair(COLOR_WHITE, COLOR_BLUE),
30, 0, msg);
CButton *nobutton = new CButton(GetTranslation("No")), *yesbutton = new CButton(GetTranslation("Yes"));
dialog->AddButton(yesbutton);
dialog->AddButton(nobutton);
TUI.AddGroup(dialog, true);
while (dialog->Run())
;
bool ret = (dialog->ActivatedWidget() == yesbutton);
delete dialog;
return ret;
}