Question

I'm completely new to COBOL, but I'd like to take a look at the different options for GUI programming on Windows. I don't really like Tcl/Tk, though. Is there some resource for developing a Windows GUI in COBOL in the same manner that one would develop a GUI in C?

Thanks!

Was it helpful?

OTHER TIPS

I used MicroFocus version 2.0 and it supported creating Windows GUI forms with an event driven model. They are now on version 5.1. Although the full version is quite expensive, there is a book with a stripped down learning version here:

http://www.murach.com/books/mcb2/microfocus.htm

For OpenCOBOL, there is an embedded Tcl/Tk layer by Rildo Pragana (author of TinyCOBOL, his TC Tcl/Tk sample compiled and linked for OpenCOBOL, first try), but if you don't like Tcl/Tk, his toolkit places almost all of the GUI on the Tk side, so:

  • There is also a GTK+ layer sample

GTK+ from OpenCOBOL, including callbacks

Source code looking like:

  *> Add a text entry field
   CALL "CBL_OC_GTK_ENTRY_NEW"
       returning gtk-textentry
   END-CALL

  *> Connect code to the text entry, passing the entry widget
   SET callback TO ENTRY "CBL_OC_activate"
   CALL "CBL_OC_G_SIGNAL_CONNECT"
       using by value gtk-textentry
           by reference "activate" & x"00"
           by value callback
           by value gtk-textentry
   END-CALL

   ...

  *> window is ready to show
   CALL "CBL_OC_GTK_WIDGET_SHOW"
       using by value gtk-window
   END-CALL

  *> Start up the event loop, control returned when GTK main exits
   CALL "CBL_OC_GTK_MAIN" END-CALL

  *> Something terminated the GTK main loop, sys-close or bye or
   display "ending..." end-display
  • FLTK worked, but I haven't posted the trial source codes.
  • GtkHTML widgets worked too.
  • A Gambas COBOL GUI layer is hosted on Google Code
  • ROOT/CINT can interpret OpenCOBOL generated C, and then you can get interactive graphs from WORKING-STORAGE.
  • Qt tested fine, but C++ requires more, albeit thin, wrapper source, so GTK was targeted instead.

Pretty much anything that can be wrapped by C, can be called by OpenCOBOL. That includes the native Microsoft WinAPI.

While working on the FAQ I found that using Vala really opens up the field for extending COBOL. As both OpenCOBOL and Vala produce intermediate C, the mixing potential is nearly unlimited, and developers can benefit from efforts by either project. I recommend checking out Vala for use from COBOL.

See the OpenCOBOL FAQ, section 5 for working samples. Screen capture image from source code listed at http://opencobol.add1tocobol.com/#does-opencobol-support-the-gimp-toolkit-gtk

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top