使用 OpenCOBOL 进行 Windows GUI 编程?

发布于 2024-07-19 14:08:45 字数 150 浏览 5 评论 0原文

我对 COBOL 完全陌生,但我想看看 Windows 上 GUI 编程的不同选项。 不过,我不太喜欢 Tcl/Tk。 是否有一些资源可以用 COBOL 开发 Windows GUI,就像用 C 开发 GUI 一样?

谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

冷心人i 2024-07-26 14:08:45

我使用了 MicroFocus 2.0 版,它支持使用事件驱动模型创建 Windows GUI 表单。 他们现在的版本是 5.1。 虽然完整版相当昂贵,但这里有一本精简学习版的书:

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

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

爱殇璃 2024-07-26 14:08:45

对于 OpenCOBOL,Rildo Pragana 有一个嵌入式 Tcl/Tk 层(TinyCOBOL 的作者,他为 OpenCOBOL 编译和链接的 TC Tcl/Tk 示例,请首先尝试),但如果您不喜欢 Tcl /Tk,他的工具包几乎把所有的 GUI 都放在了 Tk 端,所以:

  • 还有一个 GTK+ 层示例

GTK+ from OpenCOBOL ,包括回调

源代码如下所示:

  *> 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 有效,但我还没有发布试用源代码
  • GtkHTML 小部件也可以工作。
  • Gambas COBOL GUI 层托管在 Google Code
  • ROOT/CINT 上,可以解释 OpenCOBOL 生成的 C,然后您可以从 WORKING-STORAGE 获取交互式图形。
  • Qt 测试良好,但 C++ 需要更多(尽管很薄)包装源,因此 GTK 成为了目标。

几乎任何可以由 C 封装的东西都可以由 OpenCOBOL 调用。 其中包括本机 Microsoft WinAPI。

在处理常见问题解答时,我发现使用 Vala 确实开辟了扩展 COBOL 的领域。 由于 OpenCOBOL 和 Vala 都生产中间 C,因此混合潜力几乎是无限的,开发人员可以从任一项目的努力中受益。 我建议从 COBOL 中查看 Vala 的使用情况。

有关工作示例,请参阅 OpenCOBOL 常见问题解答第 5 部分。 http://opencobol 中列出的源代码的屏幕截图图像.add1tocobol.com/#does-opencobol-support-the-gimp-toolkit-gtk

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文