# SimpleTree: request for input

**URL:** <https://www.ruby-forum.com/t/simpletree-request-for-input/63071>\
**Category:** Ruby-Gnome 2\
**Created:** [June 11, 2006, 3:38pm UTC](https://www.ruby-forum.com/t/simpletree-request-for-input/63071 "2006-06-11T15:38:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [June 11, 2006, 3:38pm UTC](https://www.ruby-forum.com/t/simpletree-request-for-input/63071/1 "2006-06-11T15:38:46Z")

</div>

A start at writing a SimpleTree class that holds both a TreeStore and  
a TreeView and simplifies a lot of common cases. Also provides direct  
access to the store and the view if you want to do something more  
complicated. Still needs a lot of work, but I thought I’d get some  
reactions and suggestions before anything got too set in stone. Right  
now there’s barely enough of it to run the example from  
[http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-treeview-renderer-example](http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-treeview-renderer-example).  
Code attached, but here’s the interesting part:

# define the tree

s = Gtk::SimpleTree.new([String, String, Integer],  
[“First Name”, 0],  
[“Last Name”, 1,  
{:weight =\> Pango::FontDescription::WEIGHT\_BOLD}],  
[“Age”, format\_age, {:foreground =\> “red”}],  
[“Age”, simple\_age])

# define the initial data

treedata = [  
[‘Maria’, ‘Incognito’],  
[‘Jane’, ‘Average’, 1962,  
[‘Janinita’, ‘Average’, 1985]]]

s.import\_tree(treedata)  
s.sel\_mode = :none  
window.add(s.view)

window.show\_all  
Gtk.main

(the additional column with the ‘simple\_age’ proc is to demonstrate a  
simplified one-argument callback)

martin

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [June 12, 2006, 12:44am UTC](https://www.ruby-forum.com/t/simpletree-request-for-input/63071/2 "2006-06-12T00:44:00Z")

</div>

On 6/11/06, Martin DeMello [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> s = Gtk::SimpleTree.new([String, String, Integer],  
> [‘Janinita’, ‘Average’, 1985]]]
> 
> s.import\_tree(treedata)  
> s.sel\_mode = :none  
> window.add(s.view)
> 
> window.show\_all  
> Gtk.main
> 
> (the additional column with the ‘simple\_age’ proc is to demonstrate a  
> simplified one-argument callback)

Can’t say anything about the implementation or design at the moment,  
but I really like the idea. Be great if there was support for sorting  
and filtering.

Joe

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [June 12, 2006, 12:30pm UTC](https://www.ruby-forum.com/t/simpletree-request-for-input/63071/3 "2006-06-12T12:30:03Z")

</div>

On 6/12/06, Joe Van D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can’t say anything about the implementation or design at the moment,  
> but I really like the idea. Be great if there was support for sorting  
> and filtering.

Definitely on the to-do list, particularly filtering.

martin
