Re: [gtkmm] Manually selecting rows in Gtk::TreeView



try set_cursor(path...) method. you could get path at mouse x,y position in the tree

Simon Fuhrmann wrote:

Hi hackers!

I have a problem that deals with popup menus on Gtk::TreeView's.
I have registerd a signal handler for 'signal_button_press_event()'
of a TreeView like this:

 this->filelist.signal_button_press_event().connect
     (SigC::slot(*this, &cGuiMain::button_pressed), false);

I use 'false' as second argument to 'connect()' because if I omit
it (or set it to 'true') the TreeView will handle the right mouse
click first and my signal handler will not be called.

The 'cGuiMain::button_pressed()' signal handler will only return
'true' if it handles the right mouse button, otherwise it returns
'false', this allows the TreeView to handle all other mouse clicks.

My TreeView uses multiple selections. So if someone presses the right
mouse button and multiple rows are selected, I just want to display
my popup menu immediately, which works. But if the selection consists
of only one or none rows, I want to select the row the mouse is
over before I popup my context menu. If I don't do that, the context
menu will be created for the selected row, which must not be the one
the mouse is over, and this is strange behavior in my opinion.

How can I select the row the mouse is over from my
'cGuiMain::button_pressed()' signal handler?

Thanks for help,
Simon Fuhrmann <Nightslayer at gmx.de>

_______________________________________________
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]