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 7644911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:48:13+00:00 2026-05-31T09:48:13+00:00

I am currently trying to filter a TreeView based on the input of a

  • 0

I am currently trying to filter a TreeView based on the input of a text box, while still allowing the cells of the TreeView to be editable by the user.

The problem I’m running into is not being able to translate an edit on the TreeView while it’s using the TreeModelFilter into an edit on the child model, which is a ListStore.

The signal_connect for the cell (CellRendererText) editing looks like this:

renderer.signal_connect('edited') do |w, s1, s2|
    cell_edited(s1, s2, treeview, $status)
end

def cell_edited(path, str, trvu, cell)
  if str != ""
    iter = @store.get_iter(path)
    iter[cell] = str
  end
end

Which I will admit to being something I found doing a search for editing TreeViews in Gtk2, as I am a GTK2 and GUI newbie in general.

How do I go about translating the path in the TreeViewFilter to the path in the child model (the ListStore)?

Or put more simply: when a user edits a cell in the table while it’s filtered, how do I update the correct non-filtered entry in the list?

  • 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-31T09:48:15+00:00Added an answer on May 31, 2026 at 9:48 am

    First of all, You could write your code like below. Its more concise, and it checks to make sure that the path is valid:

    renderer.signal_connect('edited') do  |ren, path, text|
      next unless iter = @store.get_iter(path)
      iter[$status] = text if text != ""
    end
    

    You’re doing everything correctly for a normal treeview, but when you make a Gtk::TreeModelFilter, you need to convert from the filtered iter to the child’s iter using:

    Gtk::TreeModelFilter#convert_iter_to_child_iter(filter_iter)

    http://ruby-gnome2.sourceforge.jp/ja/hiki.cgi?Gtk%3A%3ATreeModelFilter

    So your code should read:

    renderer.signal_connect('edited') do  |ren, path, text|
      next unless iter = @store.get_iter(path)
      child_iter = @child_store.convert_iter_to_child(iter) 
      child_iter[$status] = text if text != ""
    end
    

    You should have a look at visualruby.net. I’ll be releasing a new version that has a great listview/treeview where you have a much easier (and more rubyish) api. The Gtk stuff gets very complicated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to create a site that filter the content based on
I'm currently trying to filter a text-file which contains words that are separated with
I'm trying to filter names out of text blobs. Currently I'm just generating a
I am trying to create a suggestion list under a text input field. Currently
im trying to create an image filter in OpenGL CE. currently I am trying
I'm trying to filter button events based on whether they have a CSS class
I'm trying to filter a table in Django based on the value of a
I'm trying to create a filter in ASP.net, where a user can select a
I'm currently trying to build a filter search function using JQuery and Ajax. The
I'm trying to get currently user credentials with a windows service in Windows 7.

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.