Re: set_selection_function



On Fri, 2007-03-02 at 16:59 -0500, Michael Comperchio wrote:
> m having a problem with ListView.I would like to be able to get at a
> selection before it changes to see if I need to update a database
> table. connecting to signal_changed() gets me access to the TreeView
> row that the ListView is going to display, but with no access to the 
> ListView row that was displayed.( Make Sense? ). So, I found this
> set_selection_function method that gets called before the selection
> actually changes. 
> 
> void Gtk::TreeSelection::set_select_function ( const SlotSelect&
> slot ) 
> 
> Great I says.Except that I don't seem to have a clue how to define the
> function to be called.

The documentation has an example method signature:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeSelection.html#2262e022dc13c1918af1127f42a158b1

And there's an example here:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch08s04.html
But this method is more about allowing you to specify what rows can be
selected rather than responding to a selection.

I think it would be best to handle the regular
TreeView::Selection::signal_changed signal. I don't see the need to do
something before the selection actually happens. 

>  When I read the documentation it says that the 
> function needs to be 
> 
> typedef sigc::slot<bool, const Glib::RefPtr<TreeModel>&, const
> TreeModel::Path&, bool> Gtk::TreeSelection::SlotSelect
> 
> I'm okay with STL type stuff, but I'm having a hard time figuring out
> just what my function definition should look like ( and the compiler
> is having a hard time with all the defferent permutations  of function
> definition I've tried)
> 
> I just nead it to call an on_leave () function before the selection
> changes so I can change some data that may/ maynot have been modified
> elsewhere on the screen....
> 
> thanks!
> 
> Michael S. Comperchio
> 332 South Main St.
> Torrington, CT 06790
> 860 485 8488
> mcmprch yahoo com

> 
-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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