aboutsummaryrefslogtreecommitdiff
path: root/examples_library/radiolist.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples_library/radiolist.c')
-rw-r--r--examples_library/radiolist.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/examples_library/radiolist.c b/examples_library/radiolist.c
index d4c93c3d406f..79da63ad749f 100644
--- a/examples_library/radiolist.c
+++ b/examples_library/radiolist.c
@@ -18,27 +18,37 @@ int main()
int i, output;
struct bsddialog_conf conf;
struct bsddialog_menuitem items[5] = {
- {"", true, 0, "Name 1", "Desc 1", "Bottom Desc 1"},
- {"", false, 0, "Name 2", "Desc 2", "Bottom Desc 2"},
- {"", true, 0, "Name 3", "Desc 3", "Bottom Desc 3"},
- {"", false, 0, "Name 4", "Desc 4", "Bottom Desc 4"},
- {"", true, 0, "Name 5", "Desc 5", "Bottom Desc 5"}
+ {"I", true, 0, "Name 1", "Desc 1", "Bottom Desc 1"},
+ {"II", false, 0, "Name 2", "Desc 2", "Bottom Desc 2"},
+ {"III", true, 0, "Name 3", "Desc 3", "Bottom Desc 3"},
+ {"IV", false, 0, "Name 4", "Desc 4", "Bottom Desc 4"},
+ {"V", true, 0, "Name 5", "Desc 5", "Bottom Desc 5"}
};
+ if (bsddialog_init() == BSDDIALOG_ERROR) {
+ printf("Error: %s\n", bsddialog_geterror());
+ return (1);
+ }
+
bsddialog_initconf(&conf);
conf.title = "radiolist";
-
- if (bsddialog_init() < 0)
- return -1;
-
output = bsddialog_radiolist(&conf, "Example", 15, 30, 5, 5, items, NULL);
bsddialog_end();
+ if (output == BSDDIALOG_ERROR) {
+ printf("Error: %s\n", bsddialog_geterror());
+ return (1);
+ }
+
+ if (output == BSDDIALOG_CANCEL) {
+ printf("Cancel\n");
+ return (0);
+ }
+
printf("Radiolist:\n");
- for (i=0; i<5; i++)
+ for (i = 0; i < 5; i++)
printf(" (%c) %s\n", items[i].on ? '*' : ' ', items[i].name);
-
-
- return output;
-}
+
+ return (output);
+} \ No newline at end of file