[Glade-users] Accessing FileSelection Dialog



RJ Krawchuk wrote:

Hi,

I have added a File Selection Dialog bog to my Glade project and I am unable
to retrieve the filename from the selection box. It is accessed from the
Menu under File-> Save As. The widget is created using (within callbacks.c):
        create_fsave();
        gtk_widget_show(fsave);

        this works fine along with the cancel button
In the button clicked signal function for the File Selection dialog box. I
have the following:
        gchar *filename;

        fsave = lookup_widget(winViewLogs, "fsave");
        filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fsave));

        printf(filename);
I have declared the GtkWidget *fsave locally, within callbacks.c and
globally and no matter how I try it I keep receiving:
        Widget not found (fsave)
        Invalid cast from pointer to GtkFileSelection
        which basically is saying it is unsbale to find fsave.

How do I access the filename from the FileSel widget. Thank you.

You can only use lookup_widget() to find widgets within the same window as
the widget you have a pointer to.

You have to keep track of pointers to other windows yourself.

The editor example included in the Glade tarball does exactly what you need.

Damon







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