Correct signal handler to overload in a treeview to STOP the selection from changing



I have a treeview derived class, in which when a branch in the tree is displayed I display a
notebook derived class showing many GUI controls for information gathering. When
the user selects a different branch in the tree, I save off the currently displayed notebook information
and display a new notebook for the new branch that is selected.
 
I accomplish this by overloading the on_cursor_changed signal handler in the tree view class.
 
The issue I am having is that when I am switching notebooks being displayed I validate any and all
information on the current notebook, if the information is valid, I want to warn the user via and keep the
tree from switching views. 
 
I am not switching the notebooks when this occurs, however the tree is still switching which branch is selected.
 
My code basically is this:
 
void CMyTreeView::on_cursor_changed()
{
    // save/validate the current notebook:
    if ( !SaveCurrentNotebook())
        return;
 
    // put up the new notebook
    .....
    return Gtk::TreeView::on_cursor_changed();
}
 
I need to know how to either return from this handler so that the selection doesn't change, or a different handler
to overload to do my processing prior to the selection change occurs.  I thought that by not allowing the
parent tree view class's version of on_cursor_changed to be called that this would happen.
 
--Bob
 


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