当前位置: 首页>>代码示例>>C++>>正文


C++ CDialog::Run方法代码示例

本文整理汇总了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;
}
开发者ID:BackupTheBerlios,项目名称:nixstaller-svn,代码行数:29,代码来源:dialogs.cpp

示例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;
}
开发者ID:BackupTheBerlios,项目名称:nixstaller-svn,代码行数:14,代码来源:dialogs.cpp

示例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;
}
开发者ID:BackupTheBerlios,项目名称:nixstaller-svn,代码行数:14,代码来源:dialogs.cpp

示例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;
}
开发者ID:BackupTheBerlios,项目名称:nixstaller-svn,代码行数:20,代码来源:dialogs.cpp


注:本文中的CDialog::Run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。