Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7609245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:07:40+00:00 2026-05-31T01:07:40+00:00

In a GTK/GTK# TreeView , how do I get the item/node which the mouse

  • 0

In a GTK/GTK# TreeView, how do I get the item/node which the mouse pointer is currently hovering over?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:07:41+00:00Added an answer on May 31, 2026 at 1:07 am

    Let’s say we want to select items using the right mouse button without using checkboxes. The following ButtonPress event handler does just that – it toggles the selected property of the item we have clicked with the RMB. We then use CellDataFuncs to highlight the selected items. tv is the TreeView, store is the underlying ListStore.

    [GLib.ConnectBefore]
    void HandleTreeViewButtonPressEvent(object o, ButtonPressEventArgs args)
    {
        if (args.Event.Button != 3)
            return;
    
        TreePath path;
        int x = Convert.ToInt32(args.Event.X);
        int y = Convert.ToInt32(args.Event.Y);
        if (!tv.GetPathAtPos (x, y, out path)) 
            return;
    
        TreeIter iter;      
        if (!store.GetIter(out iter, path)) 
            return;
        Item item = (Item) store.GetValue (iter, 0);
    
        item.Selected = !item.Selected;
        tv.QueueDraw();
    }
    

    If we are using a sorted TreeView, we have to use the TreeModelSort object instead of the ListStore object to get the correct item:

        if (!sorted.GetIter(out iter, path)) 
            return;
        Item item = (Item) sorted.GetValue (iter, 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i can't understand in GTK# how to get the selected item of a treeview.
I have GUI application with gtk.Treeview component. It's model is set to gtk.Treestore, which
My program has a gtk.TreeView which displays a gtk.ListStore . The gtk.ListStore contains strings
I have a treeview with an editable CellRendererText: self.renderer = gtk.CellRendererText() self.renderer.set_property('editable', True) But
I have a gtk.TextBuffer which is supposed to be cleared after pressing Enter, similar
i am having a issue with treeview liststore trying to get a real-time update,
I'm receiving errors from Gtk that I can't track down. Every time my mouse
I have a simple gtk.TreeView with a gtk.ListStore model and set_reorderable(True) , I want
I have a custom gtk.treeview wrapper class that manages its own liststore. The class
I'm currently writing a media player in Ruby (called Shroom ) with a GTK

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.