creating buttons in GTK+
hi. How do i pack multiple buttons into a box? I tried the following codes but in vain.
[code] GtkWidget *create(GtkWidget *b, gpointer gdata) { GtkWidget *button; GtkWidget *box1; int i; int text; gchar buffer[32]; text = gtk_entry_get_text(GTK_ENTRY(b)); /* Create box for xpm and label */ box1 = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (box1), 2); for (i=1;i<=text;i++) { sprintf (buffer, "PC %d\n", text); button = gtk_button_new_with_label(buffer); gtk_box_pack_start (GTK_BOX (box1), button, FALSE, FALSE, 3); gtk_widget_show (button); gtk_widget_show(box1); } return box1; //printf("Number of PCs: %d\n",number); } {/code] in Main() function Code:
entry = gtk_entry_new(); |
i don't remember much for C/C++ but why don't you use GLADE?
|
All times are GMT -5. The time now is 01:11 AM. |