Re: An 'oldie' question... GtkCList anyone?



On Tue, 27 Jan 2009 19:08:30 -0200
John Coppens <john jcoppens com> wrote:

On Tue, 27 Jan 2009 17:02:32 +0100
Nicola Fontana <ntd entidi it> wrote:

gtk_clist_append appends only 1 row, so that shouldn't be the problem. The
elements in the str[] array correspond to cells, the number is defined in
the CList, at creation time (gtk_clist_new takes nr of columns as
parameter). Number of columns in a CList cannot be changed dynamically.

Yes, I've seen. Anyway, just to be sure, I executed the following
program and works as expected (gtk+-2.14.5) although I had to set
the titles to see all the columns.

#include <gtk/gtk.h>

int
main(gint argc, gchar **argv)
{
    GtkWidget *window;
    GtkWidget *clist;
    gchar *values[] = {"abc", "def", "ghi", "jkl"};

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    g_signal_connect(window, "delete-event",
                     G_CALLBACK(gtk_main_quit), NULL);

    clist = gtk_clist_new_with_titles(4, values);
    gtk_container_add(GTK_CONTAINER(window), clist);

    gtk_clist_append(GTK_CLIST(clist), values);
    gtk_clist_append(GTK_CLIST(clist), values);
    gtk_clist_append(GTK_CLIST(clist), values);

    gtk_widget_show_all(window);

    gtk_main();

    return 0;
}

gtk_clist_append() dups the strings, so you can do whatever you
want with "values" after the call.

If you're lucky there's something wrong in your splitline(),
if not you're experiencing the result of a previous memory
corruption or hitting a GtkCList bug or... who knows.

Ciao
-- 
Nicola



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]