本文整理汇总了C++中dialog_inputbox函数的典型用法代码示例。如果您正苦于以下问题:C++ dialog_inputbox函数的具体用法?C++ dialog_inputbox怎么用?C++ dialog_inputbox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dialog_inputbox函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: conf_save
static void conf_save(void)
{
while (1) {
int res;
dialog_clear();
res = dialog_inputbox(NULL, save_config_text,
11, 55, filename);
switch(res) {
case 0:
if (!dialog_input_result[0])
return;
if (!conf_write(dialog_input_result)) {
set_config_filename(dialog_input_result);
return;
}
show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60);
break;
case 1:
show_helptext(_("Save Alternate Configuration"), save_config_help);
break;
case KEY_ESC:
return;
}
}
}
示例2: search_conf
static void search_conf(void)
{
struct symbol **sym_arr;
struct gstr res;
int dres;
again:
dialog_clear();
dres = dialog_inputbox(_("Search Configuration Parameter"),
_("Enter CONFIG_ (sub)string to search for (omit CONFIG_)"),
10, 75, "");
switch (dres) {
case 0:
break;
case 1:
show_helptext(_("Search Configuration"), search_help);
goto again;
default:
return;
}
sym_arr = sym_re_search(dialog_input_result);
res = get_relations_str(sym_arr);
free(sym_arr);
show_textbox(_("Search Results"), str_get(&res), 0, 0);
str_free(&res);
}
示例3: conf_load
static void conf_load(void)
{
while (1) {
int res;
dialog_clear();
res = dialog_inputbox(NULL, load_config_text,
11, 55, filename);
switch(res) {
case 0:
if (!dialog_input_result[0])
return;
if (!conf_read(dialog_input_result)) {
set_config_filename(dialog_input_result);
sym_set_change_count(1);
return;
}
show_textbox(NULL, _("File does not exist!"), 5, 38);
break;
case 1:
show_helptext(_("Load Alternate Configuration"), load_config_help);
break;
case KEY_ESC:
return;
}
}
}
示例4: search_conf
static void search_conf(void)
{
struct symbol **sym_arr;
struct gstr res;
char *dialog_input;
int dres;
again:
dialog_clear();
dres = dialog_inputbox(_("Search Configuration Parameter"),
_("Enter CONFIG_ (sub)string to search for "
"(with or without \"CONFIG\")"),
10, 75, "");
switch (dres) {
case 0:
break;
case 1:
show_helptext(_("Search Configuration"), search_help);
goto again;
default:
return;
}
/* strip CONFIG_ if necessary */
dialog_input = dialog_input_result;
if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)
dialog_input += 7;
sym_arr = sym_re_search(dialog_input);
res = get_relations_str(sym_arr);
free(sym_arr);
show_textbox(_("Search Results"), str_get(&res), 0, 0);
str_free(&res);
}
示例5: j_passwordbox
static int
j_passwordbox(JUMPARGS)
{
*offset_add = arg_rest(av);
return show_result(dialog_inputbox(t,
av[1],
numeric_arg(av, 2),
numeric_arg(av, 3),
optional_str(av, 4, 0), 1));
}
示例6: _afi_manual
int _afi_manual(dialogMenuItem *self)
{
char result[256];
int ret;
dialog_clear();
bzero(result, sizeof(result));
ret = dialog_inputbox("ClosedBSD: Manual IPFW rule addition", "Type in the rule manually. These are some sample rules that illustrate the syntax\n\n 'add allow all from any to any'\n 'add deny tcp from echelon.gov'\n 'add deny all from evilcrackers.org'\n 'add allow all from 192.168.202.0 to any out'\n\n", -1, -1, result);
if (ret == 0)
raw_add_rule(result);
return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
}
示例7: ask_option_value
static int ask_option_value(DC_Procedure *act, DC_OptionSetting *setting, DC_ProcedureOption *option) {
char *suggested_value = setting->value;
char entered_value[200];
const char *param_type_str;
char *config_supplied_value;
char *config_suggested_value;
char config_search_command[200];
snprintf(config_search_command, sizeof(config_search_command),
"grep ^%s.%s= ~/.whddrc 2>/dev/null | awk -F= '{print $2}' | tr -d '\\n'", act->name, option->name);
config_supplied_value = cmd_output(config_search_command);
if (config_supplied_value) {
setting->value = config_supplied_value;
return 0;
}
snprintf(config_search_command, sizeof(config_search_command),
"grep ^%s.%s.suggest= ~/.whddrc 2>/dev/null | awk -F= '{print $2}' | tr -d '\\n'", act->name, option->name);
config_suggested_value = cmd_output(config_search_command);
if (config_suggested_value)
suggested_value = config_suggested_value;
switch (option->type) {
case DC_ProcedureOptionType_eInt64:
param_type_str = "numeric";
break;
case DC_ProcedureOptionType_eString:
param_type_str = "string";
break;
}
char prompt[500];
snprintf(prompt, sizeof(prompt), "Please enter %s parameter: %s (%s)",
param_type_str, option->name, option->help);
dialog_vars.default_button = -1; // Workaround for surprisingly unfocused input field on old libdialog
dialog_vars.input_result = NULL;
int r = dialog_inputbox("Input box", prompt, 0, 0, suggested_value, 0);
if (r != 0) {
dialog_msgbox("Info", "Action cancelled", 0, 0, 1);
return 1;
}
// Wow, libdialog is awesomely sane and brilliantly documented lib, i fuckin love it
snprintf(entered_value, sizeof(entered_value), "%s", dialog_vars.input_result);
if (entered_value[0] == '\0' || entered_value[0] == '\n')
snprintf(entered_value, sizeof(entered_value), "%s", suggested_value);
setting->value = strdup(entered_value);
free(suggested_value);
return 0;
}
示例8: main
/* Kick it off, James! */
int
main(int argc, char **argv)
{
int retval;
unsigned char result[128];
init_dialog();
strcpy(result, "not this!");
retval = dialog_inputbox("this is dialog_inputbox() in action, test #1",
"Enter something really profound below, please.",
-1, -1, result);
dialog_clear();
fprintf(stderr, "returned value for dialog_inputbox was %d (%s)\n", retval, result);
end_dialog();
return 0;
}
示例9: conf_save
static void conf_save(void)
{
while (1) {
switch (dialog_inputbox(NULL, save_config_text, 11, 55,
filename)) {
case 0:
if (!dialog_input_result[0])
return;
if (!conf_write(dialog_input_result))
return;
show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60);
break;
case 1:
show_helptext("Save Alternate Configuration", save_config_help);
break;
case 255:
return;
}
}
}
示例10: conf_load
static void conf_load(void)
{
while (1) {
switch (dialog_inputbox(NULL, load_config_text, 11, 55,
filename)) {
case 0:
if (!dialog_input_result[0])
return;
if (!conf_read(dialog_input_result))
return;
show_textbox(NULL, "File does not exist!", 5, 38);
break;
case 1:
show_helptext("Load Alternate Configuration", load_config_help);
break;
case 255:
return;
}
}
}
示例11: main
/* Kick it off, James! */
int
main(int argc, unsigned char *argv[])
{
int retval;
unsigned char result[128];
init_dialog();
result[0]='\0';
DialogInputAttrs |= DITEM_NO_ECHO;
retval = dialog_inputbox("this is dialog_inputbox() in action, test #2 (no echo)",
"Enter something really secret below, please.",
-1, -1, result);
DialogInputAttrs &= DITEM_NO_ECHO;
dialog_clear();
fprintf(stderr, "returned value for dialog_inputbox was %d (%s)\n", retval, result);
end_dialog();
return 0;
}
示例12: conf_string
static void conf_string(struct menu *menu)
{
const char *prompt = menu_get_prompt(menu);
while (1) {
int res;
const char *heading;
switch (sym_get_type(menu->sym)) {
case S_INT:
heading = _(inputbox_instructions_int);
break;
case S_HEX:
heading = _(inputbox_instructions_hex);
break;
case S_STRING:
heading = _(inputbox_instructions_string);
break;
default:
heading = _("Internal mconf error!");
}
dialog_clear();
res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"),
heading, 10, 75,
sym_get_string_value(menu->sym));
switch (res) {
case 0:
if (sym_set_string_value(menu->sym, dialog_input_result))
return;
show_textbox(NULL, _("You have made an invalid entry."), 5, 43);
break;
case 1:
show_help(menu);
break;
case KEY_ESC:
return;
}
}
}
示例13: conf_string
static void conf_string(struct menu *menu)
{
const char *prompt = menu_get_prompt(menu);
while (1) {
char *heading;
switch (sym_get_type(menu->sym)) {
case S_INT:
heading = (char *) inputbox_instructions_int;
break;
case S_HEX:
heading = (char *) inputbox_instructions_hex;
break;
case S_STRING:
heading = (char *) inputbox_instructions_string;
break;
default:
heading = "Internal mconf error!";
/* panic? */;
}
switch (dialog_inputbox(prompt ? prompt : "Main Menu",
heading, 10, 75,
sym_get_string_value(menu->sym))) {
case 0:
if (sym_set_string_value(menu->sym, dialog_input_result))
return;
show_textbox(NULL, "You have made an invalid entry.", 5, 43);
break;
case 1:
show_help(menu);
break;
case 255:
return;
}
}
}
示例14: search_conf
static void search_conf(void)
{
struct symbol **sym_arr;
struct gstr res;
again:
switch (dialog_inputbox("Search Configuration Parameter",
"Enter Keyword", 10, 75,
NULL)) {
case 0:
break;
case 1:
show_helptext("Search Configuration", search_help);
goto again;
default:
return;
}
sym_arr = sym_re_search(dialog_input_result);
res = get_relations_str(sym_arr);
free(sym_arr);
show_textbox("Search Results", str_get(&res), 0, 0);
str_free(&res);
}