// Declare the COBOL function (assuming it's in a COBOL shared library)
extern void CBL_OC_DISPLAY_USER_INPUT(const char *value);
static int gtk_initialized = 0;
// Function to initialize GTK
void initialize_gtk() {
if (!gtk_initialized) {
gtk_init(NULL, NULL);
gtk_initialized = 1; // Prevent re-initialization
}
}
// Function to display user input in a dialog
void display_user_input(const char *input) {
if (input == NULL) {
g_warning("Input is NULL");
return; // Handle the error appropriately
}
there are GTK examples in the GnuCOBOL FAQ, and also in the GnuCOBOL Contributions SVN. Maybe it helps you. Generell the FAQ and the Contributions are good starting point, you can spare time with them.
László
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hI-
I am trying to call a dialog from cobol to GIK and output the message.
I am really stuck on this one. thanks!
thanks.
/ with much help from chatgpt /
include <windows.h></windows.h>
include <gtk gtk.h=""></gtk>
include <stdio.h></stdio.h>
ifdef _WIN64
define EXPORT __declspec(dllexport)
else
define EXPORT
endif
include "stdio.h"
include <glib-2.0 glib.h=""></glib-2.0>
include <atk atk.h=""></atk>
include <gtk gtk.h=""></gtk>
include <gdk gdk.h=""></gdk>
include <gdk gdkpixbuf.h=""></gdk>
include <gdk gdkcairo.h=""></gdk>
include <gtk gtk.h=""></gtk>
include <gtk gtk.h=""></gtk>
// Declare the COBOL function (assuming it's in a COBOL shared library)
extern void CBL_OC_DISPLAY_USER_INPUT(const char *value);
static int gtk_initialized = 0;
// Function to initialize GTK
void initialize_gtk() {
if (!gtk_initialized) {
gtk_init(NULL, NULL);
gtk_initialized = 1; // Prevent re-initialization
}
}
// Function to display user input in a dialog
void display_user_input(const char *input) {
if (input == NULL) {
g_warning("Input is NULL");
return; // Handle the error appropriately
}
}
// Example button click callback (if needed)
void on_button_clicked(GtkWidget button, gpointer data) {
const char input = "Hello from Button!";
display_user_input(input);
}
int main(int argc, char argv[]) {
GtkWidget window;
GtkWidget entry;
// GtkWidget button;
GtkWidget button2;
GtkWidget box;
}
Sent with Proton Mail secure email.
Hi,
there are GTK examples in the GnuCOBOL FAQ, and also in the GnuCOBOL Contributions SVN. Maybe it helps you. Generell the FAQ and the Contributions are good starting point, you can spare time with them.
László