How to set the text entry inside a notebook



Hi


   I have a notebook of 4 pages. Two pages have text entries. These text
entries are used to show the details that are in a system file. I need to
show those values in these text entries which will be frequently changing.
At present, I wrote the code that will show a static value.

My code:

void
on_notebook_show                       (GtkWidget       *widget,
                                        gpointer         user_data)
{
    GtkWidget *entry1,*entry2,*entry3,*entry4,*entry5,*entry6;
    gint page_no;
    page_no = gtk_notebook_get_current_page  (widget);         // Here we
get the current page number
    switch(page_no)
    {
        case 0:
        {
            char manufac[25],slno[25],tech[10],health[10];
            int temp,present,psnt,temp1;
            entry1=lookup_widget(GTK_ENTRY(widget),
"entry_manufac");          // entry_manufac is the name of the text entry
            entry2=lookup_widget(GTK_ENTRY(widget), "entry_slno");
            entry3=lookup_widget(GTK_ENTRY(widget), "entry_present");
            entry4=lookup_widget(GTK_ENTRY(widget), "entry_tech");
            entry5=lookup_widget(GTK_ENTRY(widget), "entry_health");
            entry6=lookup_widget(GTK_ENTRY(widget), "entry_temp");
            sprintf(manufac,"BCD");
            sprintf(slno,"SHF000000000");
            psnt=1;
            sprintf(present,"%d",psnt);
            sprintf(tech,"LiFe");
            sprintf(health,"Good");
            temp1=3113;
            sprintf(temp,"%d",temp1);
            gtk_entry_set_text(entry1,manufac);
            gtk_entry_set_text(entry2,slno);
            gtk_entry_set_text(entry3,present);
            gtk_entry_set_text(entry4,tech);
            gtk_entry_set_text(entry5,health);
            gtk_entry_set_text(entry6,temp);
            break;

        }
/*        case 1:
        {
            break;
        }
        case 2:
        {
            break;
        }
        case 4:
        {
            break;
        }*/
    }

}


 This code just shows the warnings and there are no errors in it. But when
we run the executable file, the text entry doesn't contain any value in it.

        What needs to be added to this?


   Looking forward for answers.....................................


aswathy



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