home *** CD-ROM | disk | FTP | other *** search
- /*
- * Test application for CForms.
- * $Log: test.frm,v $
- Revision 1.1 92/01/19 12:42:55 lasse
- Initial revision
-
- */
-
- CCode {
- #include <stdio.h>
- main()
- {
- if (cforms_init() != OK) {
- fprintf(stderr, "Failed to start cforms\n");
- exit(1);
- }
-
- if (pic_call(picture("main"), NULL) != OK) {
- fprintf(stderr, "No main picture\n");
- }
-
- cforms_end();
- }
- }
-
- Viewport view {
- Pos 0,0;
- Size 80, 24;
- }
-
- Event Key DOWN { fld_move(fld_down(current.field)); }
- Event Key UP { fld_move(fld_up(current.field)); }
- Event Key CR { fld_move(fld_next(current.field)); }
- Event Key TAB { fld_move(fld_next(current.field)); }
- Event Key HELP { message("You're using CForms"); }
- Event Key F8 { pic_leave(); }
-
- Picture Main Viewport View {
- Event Entry { fld_set(current.field, "X"); }
- Event Exit { fld_set(current.field, " "); }
- Event Key LEFT { fld_move(fld_left(current.field)); }
- Event Key RIGHT { fld_move(fld_right(current.field)); }
- Event Key F8 Forget;
-
- Event Key CR {
- if (!picture(current.field->name)) {
- message("Choise not available");
- }
- else pic_call(picture(current.field->name), NULL);
- }
-
- Literal 25, 1, "M a i n M e n u";
- Literal 25, 2, "-----------------";
-
- Field List { Pos 10, 10; Type Char(1); Protected;
- LValue "["; RValue "] Adress book"; }
-
- Field Play { Pos +0, +2; Type Char(1); Protected;
- LValue "["; RValue "] Play Game"; }
-
- Field Status { Pos +0, +2; Type Char(1); Protected;
- LValue "["; RValue "] Status Report"; }
-
-
- Field Reg { Pos 40, 10; Type Char(1); Protected;
- LValue "["; RValue "] Registration"; }
-
-
- Field Exit {
- Pos 10, 20; Type Char(1); Protected; LValue "["; RValue "] Exit";
- Event Key CR {
- pic_leave();
- }
- }
- }
-
- ccode {
- int cur_row = 0;
- }
-
- Picture Welcome Viewport View {
-
- Event Draw {
- fld_set(field("name"), fld_get(field("list:name%d", cur_row)));
- fld_set(field("adress"), fld_get(field("list:adress%d", cur_row)));
- }
-
- Event Key F8 { pic_leave(); message("Canceled"); }
-
- Event Key F1 {
- fld_set(field("list:name%d", cur_row), fld_get(field("name")));
- fld_set(field("list:adress%d", cur_row), fld_get(field("adress")));
- message("Inserted");
- pic_leave();
- }
-
- Literal 25, 1, "Person registration";
- Literal +0, +1, "-------------------";
-
- Field name {
- Pos 20, 5;
- Type Char(20);
- LValue "Name: ";
- Uppercase;
- }
-
- Field adress {
- Pos 20, 7;
- Type Char(20);
- LValue "Adress: ";
- Uppercase;
- }
-
- Literal +0, +5, "(F1 - Update) (F8 - Leave)";
- }
-
- Picture List Viewport View
- {
- Literal 25, 1, "List of persons";
- Literal +0, +1, "---------------";
-
- Event Key CR { pic_call(picture("welcome"), NULL); }
-
- Event Key DOWN {
- if (cur_row < 9 && !fld_isempty(current.field)) {
- fld_move(field("Name%d", ++cur_row));
- }
- }
- Event Key UP { if (cur_row > 0) fld_move(field("Name%d", --cur_row)); }
- Event Key Left { return; }
- Event Key Right { return; }
-
- Field Name0 { Pos 10, 5; Type Char(20); LValue "["; Protected; }
- Field Adress0 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
- Field Name1 { Pos -20, +1; Type Char(20); LValue "["; Protected; }
- Field Adress1 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
- Field Name2 { Pos -20, +1; Type Char(20); LValue "["; Protected; }
- Field Adress2 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
- Field Name3 { Pos -20, +1; Type Char(20); LValue "["; Protected; }
- Field Adress3 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
- Field Name4 { Pos -20, +1; Type Char(20); LValue "["; Protected; }
- Field Adress4 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
- Field Name5 { Pos -20, +1; Type Char(20); LValue "["; Protected; }
- Field Adress5 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
- Field Name6 { Pos -20, +1; Type Char(20); LValue "["; Protected; }
- Field Adress6 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
- Field Name7 { Pos -20, +1; Type Char(20); LValue "["; Protected; }
- Field Adress7 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
- Field Name8 { Pos -20, +1; Type Char(20); LValue "["; Protected; }
- Field Adress8 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
- Field Name9 { Pos -20, +1; Type Char(20); LValue "["; Protected; }
- Field Adress9 { Pos +20, +0; Type Char(20); RValue "]"; Protected; }
-
- Literal -20, +5, "(F8 - Leave)";
- }
-