[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    Re: Handling multiple selections in a Gtk::TreeView
From:       Matthew Walton <matthew () alledora ! co ! uk>
Date:       2004-11-26 10:10:20
Message-ID: 41A7010C.20108 () alledora ! co ! uk
[Download RAW message or body]

Murray Cumming wrote:
>>When working with multiple selections, I find
>>myself using get_selected_rows() much more frequently, to get a vector
>>or list of selected rows, then iterating over that with a for loop. I
>>might use selected_foreach more if C++ had anonymous functions.
> 
> 
> Yes, I think that get_selected_rows() was added sometime after
> selected_foreach(), because it was more convenient.
> 
> I don't understand the comment about C++ not having anonymous functions.
> Maybe that's C# terminology.

I'm not sure if C# supports anonymous functions, I was thinking more of 
Python, Haskell and Perl (Python and Haskell call them 'lambda 
functions'). They seem to be a feature of languages with late binding 
and functional languages (where functions aren't really distinct from 
values) rather than the more static kind of language, of which C++ is an 
example.

I don't know their exact syntax, but I believe that Gtk-Perl allows you 
to use anonymous subs as callbacks. If they have selected_foreach, that 
might look like this:

$treestore->selected_foreach(sub {
   # do something here
});

They're very handy, but don't really fit in the C++ mold. I suspect 
things like selected_foreach would be more useful if they did.

>>Really,
>>which one to use depends on what you want to do - sometimes
>>selected_foreach is more convenient.
> 
> 
> Actually, I can't think of a case when it is right now. If you think of
> one, let's document it.

To be honest, neither can I...

_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic