Re: active treeView



On Tue, 05 Oct 2010 17:12:00 +0200 Guillaume wrote:

(After I've corrected his quoting order...)
> 
> Le 05/10/2010 17:08, Ming-ching Chiu a écrit :
> > Hi,
> > I have multiple Tree Views in my window, and I'm trying to delete 
> > the selected row in the active tree view.  my main window captures 
> > the "delete" key, but i don't know how to check which tree view is 
> > currently active and should do the deleting operation. is there 
> > any function such as  get_active() or things like that i can call?
> >
> 
> May be Gtk::Widget::has_focus can help. See link below :
> http://library.gnome.org/devel/gtkmm/stable/classGtk_1_1Widget.html#a895663325ac65b9860e57fc60a509384
> 

The way I did it was :

    focus = get_focus();
    for ( cc=0; cc<Screen.size(); cc++ )
    {
        test = Screen[cc];
        if ( focus->is_ancestor ( *test ) )
        {
            Screen[cc]->RemoveSelected();
        }
    }

Where Screen is a std::vector of pointers to tree views, owned by the
main window. You need to use the is_ancestor method because the focus
is on a row of the tree view.

Hope that helps,
Rob


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