How to set position of menu to current clicked item of tree view and load its value?

Hi,
I need to show menu when right clicking at tree view with data(simple list_store filled with path to files).
I created Popover with Glade and later tried to use connect_button_press_event function with tree view with data

                tree_view.connect_button_press_event(move |tree_view, event| {
                    popover_right_click.show();
                    gtk::Inhibit(false)
                });

But I have two problems:

  1. I don’t see any functions which would be able to set position of this popup(event.get_position returns (f64,f64)), set_relative_to takes as argument a widget, but I want to put popover exactly at the place where user clicked.
  2. I don’t know how to see which element is clicked - tree_view.get_selection() will give info about all selected items(I use multiply selection feature) )instead lastly clicked element.
    Also probably I will need to change connect_button_press_event to connect_button_release_event because looks that selection/unselection happens after press event.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.