GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Jul 31, 2014 1:31 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Set Button label
PostPosted: Sun Mar 04, 2012 8:53 pm 
Offline
Familiar Face

Joined: Sat Mar 03, 2012 2:45 am
Posts: 18
Hello - How can i change a button label when using a ui file as the gui? I use gtk_button_set_label() function and set it as the button function and no go. The Code below is what I currently have. If i don't use GtkButton *button1; it won't compile because it's not declaired.
Code:
void test_btn ()
{      GtkButton *button1;
       gtk_widget_set_sensitive(button1, TRUE);
      gtk_button_set_label(GTK_BUTTON(button1), "Blah");
}


Thank You Y'all!


Top
 Profile  
 
 Post subject: Re: Set Button label
PostPosted: Sun Mar 04, 2012 10:50 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
You shoudn't be declaring it as GtkButton* but as GtkWidget* As new widget creation functions output to GtkWidget* by and large. You seem to be missing one of those too. Where's the gtk_button_new function or evidence that you are passing a ppointer to it to the function? You probably want gtk_button_new_with_label or _mnemonic. as to your question though this implies you have already created the button and want to change the label such as by gtk_button_set_label. The tutorials on the gtk website give a sound basis for button creation and the documentation (e.g. http://developer.gnome.org/gtk/2.24/GtkButton.html#gtk-button-set-label) should be abe to fill in the gaps from there.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group