Fwd: set_select_function



Hi all,
I've a Gtk::TreeView with ListStore as its model. I want to make atleast one row of the liststore be selected always. For that I'm using Gtk::TreeSelection::set_select_function. I've two questions regarding this.

say, select_function is the name of the function we pass to set_select_function

myTreeView->get_selection()->set_select_function (sigc::mem_fun (*this, &MyClass::select_function)) ;

1. I've observed that when ever i select a row, the control is going to this function thrice. I can understand Thrice. (once for the selected row, and the next time for the "going to be selected" row. But why third time.
The sequence is,
function call for "about to be selected" row
function call for "about to be deselected" row
function call for "about to be selected" row.

Why three times? why second time for "about to be selected" row.

2. Is there any other way to achive my objective. (Atleast one row of the listview should always be selected.) So when the user is about to deselect a last selected row, disable the functionality.

Thanks in advance,
Surya


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