Re: How to unselect a row in the TreeView, when it is selected secondtime?
- From: "Paul Davis" <pjdavis engineering uiowa edu>
- To: "SaiKamesh Rathinasabapathy" <rsaikamesh gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: How to unselect a row in the TreeView, when it is selected secondtime?
- Date: Tue, 24 Apr 2007 04:18:31 -0500
Update:
This sure isn't working. I'll get back when I get it figured out a bit better.
Paul
On 4/24/07, Paul Davis <pjdavis engineering uiowa edu> wrote:
SaiKamesh,
You're gonna have to track the selection manually. This will require
you to connect to the signal_button_press.
The basic outline will basically be something like:
//Some necessary values.
Gtk::TreeView* tree_view = ... ;
Glib::RefPtr< Gtk::TreeSelection > selection = .... ;
//Notice the connect_notify() as opposed to connect()
tree_view->signal_button_press_event().connect_notify( ... )
void
on_button_press( GdkEventButton* ev )
{
Gtk::TreeModel::Path p ;
Gtk::TreeViewColumn* tvc ;
int cx ;
int cy ;
if( ! tree_view->get_path_at_pos( ( int ) ev->x, ( int ) ev->y,
p, tvc, cx, cy )
{
return ;
}
if( tree_selection->is_selected( p ) )
{
tree_selection->unselect( p ) ;
}
else
{
tree_selection->select( p ) ;
}
}
Should be pretty much it unless I'm forgetting something.
Paul
On 4/24/07, SaiKamesh Rathinasabapathy <rsaikamesh gmail com> wrote:
> Hi,
>
> I have added a tree_view( Gtk::TreeView ) in a window.
>
> What I have to do is, if a row is selected at the first time, then it will
> be highlighted. -> Actually we don't need to do anything for this. It will
> automatically be highlighted.
>
> If the same row is clicked (or selected) at the second time, the row should
> be unselected.
>
> if the same row is clicked (or selected) at the third time, then it sholud
> again be highlighted.
>
> I tried to do the above several times. But I could not do it. Please help
> me out to do this!
>
> Thanks in advance!
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]