Re: GtkFileChooser for an Entry



On Tue, 27 Jul 2004, William Dest wrote:
FileChooserDialog function to get populated into the
entry, since the callback function isn't associated
directly with the Entry.  I've considered creating a
You don't have to use a callback function.
Create your dialog box using gtk_file_selection_new(...)
then call gtk_dialog_run (file_selector).
gtk_dialog_run will run the dialog and return only after the user has 
closed it. Just stick a button next to your entry box and on the click 
event, call gtk_dialog_run. No need to use a callback with this method.
Ex:
void browse()
{
        GtkWidget * file_selector;
        file_selector = gtk_file_selection_new ("Blah");
        if (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG(file_selector))
        {
                char * file = (char *)gtk_file_selection_get_filename
                        (GTK_FILE_SELECTION(file_selector));
                /* populate your entry widget using the file variable */
        }
        gtk_widget_destroy (file_selector);
}


Hope that helps




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