Re: Error when executing my app



The prototype for a delete_event handler is
gboolean function( GtkWidget *, GdkEvent *, gpointer user_data);

gtk_main_quit() doesn't match this since it is
a parameterless function.  You might try adding a handler such as
this:

gboolean quit_handler( GtkWidget *, GdkEvent *, gpointer user_data)
{
    gtk_main_quit();
    return (FALSE);
}

The return is whether you are preventing the user from quitting - gives
you a chance to clean-up, ask if sure they want to quit, etc.  return
of FALSE allows them to quit.

Then attach the quit_handler through your delete_event......

HTH,
Donna
P.S. Of course there's also the destroy event to think about :-).
I would actually have the delete-event do a return FALSE
(and whatever else it needed) and allow the destroy event to do the
quit......
That way I can also use the destroy handler for any quit buttons or
menu items.   Personal preference I guess....

----- Original Message -----
From: Chi Wa Au <cau erggroup com>
To: <gtk-app-devel-list gnome org>
Sent: Tuesday, February 27, 2001 2:01 AM
Subject: Error when executing my app


I have written a simple test program:

#include <gtk/gtk.h>

int main(int argc, char *argv[])
{
    GtkWidget *win, *label;

    gtk_init(&argc, &argv);

    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_signal_connect(GTK_OBJECT(win), "delete_event",
GTK_SIGNAL_FUNC(gtk_main_quit), NULL);

    label = gtk_label_new("Hello");
    gtk_container_add(GTK_CONTAINER(win), label);

    gtk_widget_show_all(win);

    gtk_main();

    return 0;
}


The compilation was OK but when I tried to execute the compiled program,
the following error was returned:

Gdk-ERROR **: BadAccess (attempt to access private resource denied)
  serial 75 error_code 10 request_code 88 minor_code 0

Can anyone tell me what the error is and where I can find the definitions
for 'error_code', 'request_code' and minor_code.

Thanks in advance,
Au Chi Wa
ERG



---------------------------- ERG Group --------------------------
 The contents of this email and any attachments are confidential
 and may only be read by the intended recipient.
-----------------------------------------------------------------


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list






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