Building EGL Text User Interface applications

A Text UI application presents a text-based user interface similar to that of a 5250 or 3270 terminal.

You can use the EGL Text UI technology to create a very basic user interface, like one you would find on a mainframe. This means you can generate programs for both COBOL and Java™ that present an identical interface to the user.

Text UI interfaces are based on forms. A form contains fields that are displayed together on a screen page or sent together to a printer. Properties determine how each field is displayed or printed within the form.

Each EGL Form part must be part of a FormGroup.

Text UI programs carry on a conversation with the user. The EGL converse statement gives control to the form; when the user presses a key, control returns to the program and the program processes the information in the form.

Example

To create a simple Text UI program, first create a FormGroup in a new EGL source file:
FormGroup myFormGroup

   Form myTextForm type textForm {formSize=[10,80]}
      msgField CHAR(80);
   end
end
Next, in a new EGL source file, create a program with a use statement that references the FormGroup:
Program HelloWorld type textUIprogram
   {}
   use myFormgroup;
   myMessage char(25) = "myMessage";

   function main()
      while (ConverseVar.eventKey not pf3)
         myTextForm.msgField = myMessage;
         converse myTextForm; 
         if (ConverseVar.eventKey is pf3)
            exit program;
         end
         if (ConverseVar.eventKey is pf1)
            myMessage = "Hello World";
         end
      end
   end
end

If you press the F1 key, the message changes from "myMessage" to "Hello World". If you press the F3 key, the program exits.


Feedback