hi perl monkies, I need help in creating a simple editable treeview. Back in Gtk2, I am using Gtk2::SimpleList. Now I am having a problem because the SimpleList was removed on the Gtk3.
Now I did my research and end up with this...
my $model = Gtk3::ListStore->new('Glib::String');
my $list = Gtk3::TreeView->new();
$list->set_model($model);
my $cell = Gtk3::CellRendererText->new();
$cell->set('editable'=>1);
my $column = Gtk3::TreeViewColumn->new_with_attributes('name',$cell,'t
+ext',$i);
$list->append_column($column);
The problem here is that if I added a new row and tries to edit the contents of it by double clicking and typing a new text after I press enter, the new text is not updated. So I did googling around and found this site.
http://python-gtk-3-tutorial.readthedocs.org/en/latest/cellrenderers.h
+tml#cellrenderertext
It says that I need to update the liststore manually using the edited signal. Problem is that I can't seem to find a way to properly get the iterator of the row so that I could update the liststore manually by using:
$list->set($iter,0,'edited text here');
Please help. Thanks in Advance
Mabuhay Civil Engineers! :D
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.