Re: FileSelection Error



Hi!

I think the problem is you are using a C++ function as a callback
function. You will have to use a C function or use some kind of
equivalent gtkmm function that calls the C++ function through a C
function.

>   g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION
>                               (myData->fileSelector)->ok_button),
>                    "clicked", G_CALLBACK(rawDataFilename), myData);
> 

change the function rawDataFilename() to a C function (which can be a
friend function in your class)

Hope this helps.

Regards

On Thu, 2003-04-24 at 08:01, Audrey Vernon wrote:
> 
> I have the following code to get a filename with a file selection tool, but it gives my the X window error shown below.  Any ideas what might cause this and how I can fix it?
> 
> 
> void WorkspaceManip::saveRawData(GtkWidget *link, WorkspaceManipData *myData)
> {
>   // Create the file selector
>   myData->fileSelector = gtk_file_selection_new ("Save Raw Data");
> 
>   g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION
>                               (myData->fileSelector)->ok_button),
>                    "clicked", G_CALLBACK(rawDataFilename), myData);
> 
>   g_signal_connect_swapped (GTK_OBJECT
>                             (GTK_FILE_SELECTION
>                              (myData->fileSelector)->cancel_button),
>                             "clicked",
>                             G_CALLBACK (gtk_widget_destroy),
>                             (gpointer) myData->fileSelector);
> 
>   // Display that dialog
>   gtk_widget_show (myData->fileSelector);
> }
> 
> 
> void WorkspaceManip::rawDataFilename(GtkWidget *w, WorkspaceManipData *myData)
> {
>   gchar *selected_filename =(gchar *) gtk_file_selection_get_filename
>     (GTK_FILE_SELECTION(myData->fileSelector));
>   gtk_widget_destroy(myData->fileSelector);
> }
> 
> 
> 
> 
> The program '<unknown>' received an X Window System error.
> This probably reflects a bug in the program.
> The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
>   (Details: serial 13370 error_code 9 request_code 55 minor_code 0)
>   (Note to programmers: normally, X errors are reported asynchronously;
>    that is, you will receive the error a while after causing it.
>    To debug your program, run it with the --sync command line
>    option to change this behavior. You can then get a meaningful
>    backtrace from your debugger if you break on the gdk_x_error() function.)
> 





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