Newbie -> About gtk_clist_find_row_from_dat



Hello.

I have a gtkclist list with 2 columns. When I add lines to my list, I
would like to make sure that there is not another similar line.
Well, I want the first column of my list not to have a repeated token.
I have wrote this code (I have used gtk_clist_find_row_from_data, but it
doesn't work).

Note: I'm testing the output of the gtk_clist_find_row_from_data
function by writting the returned value. I always obtain -1...

What's wrong?

Sorry for my english. Greetings from Spain.

[My code]

void boton1(GtkButton *widget, gpointer data)
{

        gchar *cadenas[2];
     
        cadenas[0] = (gchar *) malloc(255);
        cadenas[1] = (gchar *) malloc(255);
        cadenas[0] = gtk_entry_get_text((GtkEntry *) entry1);
        cadenas[1] = gtk_entry_get_text((GtkEntry *) entry2);
        

        if ((strcmp(cadenas[0],"")==0)||((strcmp(cadenas[1],"")==0)))
          printf("Cadenas vacía\n");
        else
          {                                                
            printf("[%i]", (gtk_clist_find_row_from_data((GtkCList *)
clist1,(gpointer)cadenas[0])));  
            gtk_clist_append((GtkCList *) clist1, cadenas);
          }
}


--
Antonio Martínez Álvarez, <antonioma eresmas net>










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