Re: [gtkmm] Good example of a Gtk::FileSelection that supports multpile selecting



This isn't difficult...

Enable multiple selection on your Gtk::FileSelection by calling

fileselection.set_select_multiple(true);

Then to retrieve the list of selected files, use the

Glib::ArrayHandle<std::string> Gtk::FileSelection::get_selections()
const

method - for example:

void on_fileselection_ok() {
  std::list<std::string> selectedfiles;
  selectedfiles = fileselection.get_selections();
  // do something with selectedfiles list here
}

If you're still stuck, check out the towel-gtk2 module from Towel CVS
http://towel.sf.net (or use the SourceForge CVS browser) and have a look
in gui-playlist.cc, that uses a multiselect fileselection widget to add
files to the playlist. For the time being, at least.

On Fri, 2003-01-03 at 03:32, Rus Hughes wrote:
> I've tried Google, and I tried looking in the FAQ for applications
> written in Gtkmm (the /extra.html doesnt exist btw) but I can't find any
> examples of using the FileSelection with multiple selected. Does anyone
> know of any online examples or source code on the web that could help me
> please?
> 
> Thanks
-- 
Matthew Walton <mxw00u cs nott ac uk>




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