Trying to add widgets via callback

I'm trying to add widgets into a vbox when a user clicks on a button.
Unfortunately, all I'm getting so far is SegV.  I've run the program
through gdb and I think I'm having problems passing my vbox (pointer)
into the callback, but I'm not sure of the remedy.
If anyone could help me, I'd be most appreciative.

Here is the code I'm using:

GtkHandleBox *
newEntry (char *note) {

 GtkWidget *entry_area;
 GtkWidget *container;

 container = gtk_handle_box_new();
 entry_area = gtk_entry_new();


 return GTK_HANDLE_BOX(container);

addEntry (GtkWidget widget,
          GtkBox **container_to_add_to) {

 GtkWidget *entry_box;
#if 0
The next line is where I segV out.  At one point I was passing
container_to_add_to in as a GtkWidget * and then the segV occurred
in the casting function GTK_BOX(container_to_add_to)....


GtkWindow *
newWindow (GtkHandleBox *initial_note) {

/* Define the basic necessities of a window. */
 GtkWidget *top_window;
 GtkWidget *vbox;
 GtkWidget *new_entry_button;

/* Create the widgets that go into our program. */
 top_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);  // Create Managed window
 vbox = gtk_vbox_new(FALSE,0);              // Create the layout box.
 new_entry_button = gtk_button_new_with_label("New Entry");

 gtk_signal_connect(GTK_OBJECT(top_window), "delete_event",
                    GTK_SIGNAL_FUNC(closeWindow), top_window);

 gtk_signal_connect(GTK_OBJECT(new_entry_button), "clicked",
                    GTK_SIGNAL_FUNC(addEntry), &vbox);


-Toshio Kuratomi <>
badger    \\  "What's all this?  What's all this?"
@prtr-13    \\   -Mr. Banks, Mary Poppins     \\=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

PGP signature

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