Re: button label problem



vyadav cdotd ernet in wrote:

hi all .
         how can we change the label of button after clicking it ...
 i mean..i have set one label for the buttton..and i want to change it
when i click on the button...

   plz help...
   thanx...
just do smth like this:

---

void button_clicked(GtkButton *button, gpointer data)
{
static gint button_click_count=0;
gchar label[32];

   sprintf(label, "label N%d", button_click_count++);
   gtk_button_set_label(button, label);
}

void button_setup()
{
GtkWidget *button;

   ...

   button = gtk_button_new_with_label("label N0");
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(button_clicked), NULL);
   gtk_widget_show(button);

   ...
}

---

Olexiy




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