summaryrefslogtreecommitdiff
path: root/lib/libforms/examples
diff options
context:
space:
mode:
authorPaul Richards <paul@FreeBSD.org>1995-03-26 07:44:33 +0000
committerPaul Richards <paul@FreeBSD.org>1995-03-26 07:44:33 +0000
commit62773adf71f81f85a396213412e55bec1f9c7186 (patch)
tree74529f2af39672789431bf89b4541f799c86b669 /lib/libforms/examples
parentbdb44d5fb6c056c07dc2ad478bb50b3756349a8a (diff)
Notes
Diffstat (limited to 'lib/libforms/examples')
-rw-r--r--lib/libforms/examples/example.c16
-rw-r--r--lib/libforms/examples/example.frm9
2 files changed, 17 insertions, 8 deletions
diff --git a/lib/libforms/examples/example.c b/lib/libforms/examples/example.c
index f2dad1c9a6a7..447d8468cb1b 100644
--- a/lib/libforms/examples/example.c
+++ b/lib/libforms/examples/example.c
@@ -32,8 +32,11 @@
*
*/
#include <stdio.h>
+#include "../hash.h"
#include "../forms.h"
+extern hash_table *global_bindings;
+
main()
{
struct Tuple *tuple;
@@ -42,8 +45,6 @@ main()
initscr();
- form_bind_tuple("exit_form", FT_FUNC, &exit_form);
- form_bind_tuple("cancel_form", FT_FUNC, &cancel_form);
if (form_load("example.frm") == FS_ERROR)
exit(0);;
@@ -59,7 +60,7 @@ main()
cbreak();
noecho();
- tuple = form_get_tuple("example", FT_FORM);
+ tuple = form_get_tuple(global_bindings, "example", FT_FORM);
if (!tuple)
err(0, "No such form");
else
@@ -67,6 +68,9 @@ main()
print_status("This is the status line");
+ form_bind_tuple(form->bindings, "exit_form", FT_FUNC, &exit_form);
+ form_bind_tuple(form->bindings, "cancel_form", FT_FUNC, &cancel_form);
+
res = form_show("example");
while (form->status == FS_RUNNING) {
@@ -79,11 +83,11 @@ main()
if (form->status == FS_EXIT) {
printf("You're entries were:\n\n");
- tuple = form_get_tuple("input1", FT_FIELD_INST);
+ tuple = form_get_tuple(form->bindings, "input1", FT_FIELD_INST);
printf("Input 1 = %s\n", ((struct Field *)tuple->addr)->field.input->input);
- tuple = form_get_tuple("input2", FT_FIELD_INST);
+ tuple = form_get_tuple(form->bindings, "input2", FT_FIELD_INST);
printf("Input 2 = %s\n", ((struct Field *)tuple->addr)->field.input->input);
- tuple = form_get_tuple("menu1", FT_FIELD_INST);
+ tuple = form_get_tuple(form->bindings, "menu1", FT_FIELD_INST);
res = ((struct Field *)tuple->addr)->field.menu->selected;
printf("Menu selected = %d, %s\n", res,
((struct Field *)tuple->addr)->field.menu->options[res]);
diff --git a/lib/libforms/examples/example.frm b/lib/libforms/examples/example.frm
index d1f5349237bd..f28b2c65b2c5 100644
--- a/lib/libforms/examples/example.frm
+++ b/lib/libforms/examples/example.frm
@@ -1,9 +1,14 @@
-field1 { attributes = 0 text = "This text is bold and flashy" }
+Colours example_colors {
+ pair = red, yellow
+ pair = blue, white
+}
+
+field1 { attributes = 0 text = "\standout This text is \bold bold and \blink flashy" }
field2 {
height = 2
width = 22
- text = "This is an input field with a default"
+ text = "This is an input fieldwith a default"
}
field3 {