hye szg



 i have made a prog in gtk it is running but now showing me the button in that that i have already added can 
u help me in that

/* hello-gtk.c */
                                                                                                              
               
#include <gtk/gtk.h>
                                                                                                              
               
gint QuitProg(GtkWidget *widget, gpointer gdata){
                                                                                                              
               
    gtk_main_quit();
    return (FALSE);
                                                                                                              
               
}
                                                                                                              
               
int main (int argc, char *argv[]){
                                                                                                              
               
    GtkWidget *window;
    GtkWidget *text_pane;
    GtkWidget *button;
                                                                                                              
               
    gtk_init(&argc, &argv); /*required initializing */
                                                                                                              
               
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_usize(window,400,100);
    gtk_window_set_title(GTK_WINDOW(window) , "VIVEK PATEL");
    gtk_container_set_border_width(GTK_CONTAINER(window),5);
                                                                                                              
               
    gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC(QuitProg), NULL);
                                                                                                              
               
    text_pane = gtk_text_new(NULL, NULL);
    gtk_text_set_editable(GTK_TEXT(text_pane) , FALSE);
    gtk_container_add(GTK_CONTAINER(window) , text_pane);
    gtk_widget_realize(text_pane);
    gtk_text_insert(GTK_TEXT(text_pane),NULL,NULL,NULL,"Hello vivek this is ur first gtk based programming  
\n\n" , -1);
                                                                                                              
               
/* The final step is to display this newly created widget. */
   button=gtk_button_new_with_label("hye");
  gtk_container_add (GTK_CONTAINER (window), button);
   gtk_widget_show (button);
                                                                                                              
               
/* this displays the text pane and also the window is shown from here*/
                                                                                                              
               
    gtk_widget_show(text_pane);
    gtk_widget_show (window);
                                                                                                              
               
    gtk_main ();
                                                                                                              
               
                                                                                                              
               
                                                                                                              
               
}




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