Re: Gtk::FileChooserButton




On 29 Apr 2011, at 11:46, Emmanuel Thomas-Maurin wrote:


Have you tried with Gtk::FileChooser::set_current_name() instead ?


I just decided to try it (once again, passing an empty string) but I got this debug output:-

" Gtk-CRITICAL **: file ..\gtk\gtkfilechooserdefault.c line 7284: assertion 'impl->action == 
GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREAT_FOLDER' failed "

I assume that Gtk::FileChooser::set_current_name() is only supposed to be used when saving a file or creating 
a new one.  In my case, my use of FileChooser is for opening an already existing file.

Having said that, I'm glad you suggested it.  When I was looking at the info for that function I came across 
Gtk::FileChooser::unselect_filename().  Using that function is much more robust than my previous strategy of 
trying to set an empty filename.  Oddly enough though, despite its name it doesn't seem to unselect the 
previously selected file.  I've been passing the full path to the file though....  maybe I should only pass 
the file's name.  I'll try some experimenting to see if I can make sense of it.  Happily though, calling 
'unselect_filename()' does get rid of the two weird knock-on effects that I encountered (i.e. - 1. bizarrely 
selecting my app's installation folder - and 2. the FileChooser dialog subsequently refusing to acknowledge 
mouse clicks).

So it looks like this is a much better route than the one I was using previously.  I just need to find out 
how to select "no selection".

John


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