/* Various general purpose dialogs */ #include #include "tlmpdia.h" class _F_diapopup1_private { public: DIALOG dia; }; void _F_diapopup1::dismiss() { priv->dia.hide(); } /* A popup dialog with a single text field. The user enter the value and the ok functag is called. Return -1 if the used escaped or whatever was set in retcode in the ok functag. */ int diapopup1 ( _F_diapopup1 &c, const char *title, const char *intro, const char *ftitle, const char *initval, HELP_FILE &help) { int ret = -1; _F_diapopup1_private priv; c.priv = &priv; priv.dia.settype (DIATYPE_POPUP); SSTRING field(initval); priv.dia.newf_str (ftitle,field); priv.dia.last_noempty(); while(1){ MENU_STATUS code = priv.dia.edit (title,intro,help); if (code == MENU_ESCAPE || code == MENU_CANCEL){ break; }else{ int retcode = 0; bool reject = false; c.ok (field.get(),reject,retcode); ret = retcode; if (!reject) break; } } return ret; }