gtk_button_set_label does not change the label
- From: ghum <avalik yahoo com>
- To: gtk-app-devel-list gnome org
- Subject: gtk_button_set_label does not change the label
- Date: Sat, 10 Dec 2011 09:56:25 -0000
Hello,
I am trying to change button label with gtk_button_set_label. the code
doesn't output any error messages, but the label doesn't change.
Here is code:
#include <gtk/gtk.h>
void pradetibutton_clicked (GtkWidget *proglog, GtkTextBuffer *logbuffer,
GtkWidget *pradetibutton, gpointer data)
{
GtkTextIter start, end;
gtk_text_buffer_get_bounds (logbuffer, &start, &end);
gtk_text_buffer_set_text (logbuffer, "pakeistas tekstas", -1);
gtk_button_set_label (GTK_BUTTON(pradetibutton), "baigti");
while (g_main_context_iteration (NULL, FALSE));
}
void destroy(GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
int main( int argc, char *argv[])
{
gtk_init (&argc, &argv);
GtkWidget *window;
GtkWidget *vbox1;
GtkWidget *hbox1;
static GtkWidget *pradetibutton;
GtkWidget *proglog;
GtkTextBuffer *logbuffer;
GtkWidget *scwind1;
gtk_init(&argc, &argv);
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "DP2");
gtk_window_set_default_size(GTK_WINDOW(window), 500, 300);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy),
NULL);
vbox1=gtk_vbox_new (FALSE,5);
gtk_container_add (GTK_CONTAINER (window), vbox1);
hbox1=gtk_hbox_new (FALSE,5);
gtk_box_pack_start (GTK_BOX(vbox1),hbox1,FALSE, FALSE, 1);
pradetibutton = gtk_button_new_with_label ("pradÄti");
gtk_box_pack_start (GTK_BOX(hbox1),pradetibutton,FALSE, FALSE, 1);
proglog = gtk_text_view_new();
logbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (proglog));
gtk_text_buffer_set_text (logbuffer, "Hello, this is some text", -1);
scwind1 = gtk_scrolled_window_new(NULL, NULL);
gtk_box_pack_end (GTK_BOX(vbox1),scwind1,TRUE, TRUE, 3);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW (scwind1),
proglog);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scwind1),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
g_signal_connect (G_OBJECT (pradetibutton), "clicked", G_CALLBACK
(pradetibutton_clicked), logbuffer);
gtk_widget_show (scwind1);
gtk_widget_show (proglog);
gtk_widget_show (pradetibutton);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
thanks
--
View this message in context:
http://old.nabble.com/gtk_button_set_label-does-not-change-the-label-tp32950770p32950770.html
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]