treeview
- From: christophe Meyer <chr meyer nerim net>
- To: gtk-app-devel-list gnome org
- Subject: treeview
- Date: Tue, 20 Jan 2004 21:24:17 +0100
Hi,
I have to make a simple one-column item list, using a Treeview or a list, but
lists seem to be de disadvised and deprecated so i think i'm going to use
a treeview. What do you think about that ? should i rather use a list ?
I've already watched the online documentation about treeviews and
especially GtkListStore (this may be what i must use), but i didn't found
many examples.
I use glade to design my interface, so how can i concretely link this
(http://developer.gnome.org/doc/API/2.0/gtk/GtkListStore.html) example
to my "treeview1" (and display it) ???
enum {
COLUMN_STRING,
COLUMN_INT,
COLUMN_BOOLEAN,
N_COLUMNS
};
{
GtkListStore *list_store;
GtkTreePath *path;
GtkTreeIter iter;
gint i;
list_store = gtk_list_store_new (N_COLUMNS,
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_BOOLEAN);
for (i = 0; i < 10; i++)
{
gchar *some_data;
some_data = get_some_data (i);
/* Add a new row to the model */
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
COLUMN_STRING, some_data,
COLUMN_INT, i,
COLUMN_BOOLEAN, FALSE,
-1);
/* As the store will keep a copy of the string internally, we
* free some_data.
*/
g_free (some_data);
}
Has anyone already done something like that ? does anyone know
simple examples or tutorials about that ?
Thanks for all your help :)
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]