Problems using GtkTreeView and making stuff editable
- From: Philip Van Hoof <spamfrommailing freax org>
- To: gtk_list gtk gtk <gtk-app-devel-list gnome org>
- Subject: Problems using GtkTreeView and making stuff editable
- Date: 25 Sep 2002 16:14:41 +0200
Hi there,
I want to create a GtkTreeView widget with two editable textcolumns
All seems to work and the textfields are editable but when I edit them
and then press 'enter' or 'tab' then the original text is back in
place (so I can edit it, but after editing all changes are discarded).
What am I doing wrong? :-\
enum
{
TARGET_COLUMN,
MAXSIZE_COLUMN,
N_COLUMNS
};
pwin->tarstore = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING,
G_TYPE_INT);
pwin->tartreeview = gtk_tree_view_new_with_model
(GTK_TREE_MODEL(pwin->tarstore));
pwin->tartargetcolumn = gtk_tree_view_column_new();
pwin->text1cell = gtk_cell_renderer_text_new ();
gtk_tree_view_column_set_title (pwin->tartargetcolumn, _("Target"));
gtk_tree_view_column_pack_start(pwin->tartargetcolumn,
pwin->text1cell, TRUE);
gtk_tree_view_column_set_attributes(pwin->tartargetcolumn,
pwin->text1cell,
"text", TARGET_COLUMN, "editable", TRUE, NULL);
pwin->tarmaxsizecolumn = gtk_tree_view_column_new();
pwin->text2cell = gtk_cell_renderer_text_new ();
gtk_tree_view_column_set_title (pwin->tarmaxsizecolumn, _("Max.
Length"));
gtk_tree_view_column_pack_start(pwin->tarmaxsizecolumn,
pwin->text2cell, TRUE);
gtk_tree_view_column_set_attributes(pwin->tarmaxsizecolumn,
pwin->text2cell,
"text", MAXSIZE_COLUMN,"editable", TRUE, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (pwin->tartreeview),
pwin->tartargetcolumn);
gtk_tree_view_append_column (GTK_TREE_VIEW (pwin->tartreeview),
pwin->tarmaxsizecolumn);
--
Philip Van Hoof
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]