Gtk Question


        I am starting to use Gtk and seem to be running into a small
Other than the problem mentioned below, everything else I have tried
seems to work fine. 

        Included is the code for a small "Hello World" type program. I
trying to pass data to the "callback" for the "delete_event" handler for
a window and can't seem to get it to work. I have tried this with Gtk
1.0.3 on Solaris. I realise I am probably missing something obvious. Any
help you could provide would be greatly appreciated...

        Anyway here is the code...


#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>

gint windowSignalHandlerStub(GtkWidget *w, gpointer data) {

  char *junk = (char *) data;

  printf("Received the following data: %s\n", junk);
  return TRUE;

int main (int argc, char *argv[])
  GtkWidget *window;

  char *aCommand;
  aCommand = strdup("Foo");

  gtk_init (&argc, &argv);
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                     (gpointer) aCommand);

  gtk_main ();
  return 0;


        Thanks for your time.


PS: Passing data to the callbacks for the widgets works just fine....

Achint Sandhu

Windows 95: n. 32-bit extensions and a graphical shell for
               a 16-bit patch to an 8-bit operating system originally 
               coded for a 4-bit microprocessor, written by a 2-bit 
               company that can't stand for 1 bit of competition.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]