(no subject)



I am writting an app that uses a clist, and a frame, and, when the clist is
selected, information about that row should be showed in the frame.

I used the following code to connect the signal:

frame = gtk_frame_new("Result");
gtk_signal_connect(GTK_OBJECT(clist), "select_row",
        GTK_SIGNAL_FUNC(callback_select_row), (gpointer) frame);

and this one as a callback:
void callback_select_row(GtkWidget *widget, gint row, gint column,
                        GdkEventButton *event, gpointer data) {
    GtkWidget *box, *label;
    gint i;

    /* code for reading data */
    box = gtk_vbox_new(TRUE, 1);
    for (i = 0; i < x; i++) {
        sprintf(str, "%s: %s", field[i].name, row[i]);
        label = gtk_label_new(str);
        gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0);
        gtk_widget_show(label);
    }
    gtk_container_add(GTK_CONTAINER(data), box);
    gtk_widget_show(box);

It works perfectly when i select a line from the list for the first time, but
when i select another one, it keeps showing the data, related to the first
selected row. I need someway to clear, the contents of the frame, or box,
before adding new things. I am new at gtk and i have no clue how to achieve it.


------ BEGIN GEEK CODE BLOCK-----
Version: 3.1
GU d-(?) s+:- a--- C++(+++)>$ UBL++>$ P+ L++>$ !E W++ N? o? K? w- O- M- V- PS
PE+(++) Y? PGP- t S? X? R+ tv- b+ DI? D- G++ e- h! r- y?
------ END GEEK CODE BLOCK ------

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




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