GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Mon Dec 22, 2014 7:53 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: I need a example code for gtk_label_get_label( );
PostPosted: Sat Jan 11, 2014 6:39 am 
Offline
Familiar Face

Joined: Fri Jan 10, 2014 2:29 pm
Posts: 21
Hello,
I'm new to GTK , I'm using GTK in C language and i want to fetch label of a button or any LABEL widget in any char array so that i can perform further manupulations


Top
 Profile  
 
 Post subject: Re: I need a example code for gtk_label_get_label( );
PostPosted: Sun Jan 12, 2014 9:57 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 799
Location: UK
Hello,

Rough example code to get a pointer to the string from the label widget and the button widget.

Code:
{
  GtkWidget *a_label;
  GtkWidget *a_button;
  const gchar *string;

....
  /* Gets a string pointer from the label widget */
  string = gtk_label_get_label (GTK_LABEL (a_label));
....

  /* Gets a string pointer from the button widget */
  string = gtk_button_get_label (GTK_BUTTON (a_button));

....
}

Note in both cases the returned pointer can be NULL, the string belongs to the widget so must not be modified or freed.

Since you are a beginner I would suggest that you have a look at some examples and work through some of the tutorials. A fairly good one can be found at http://zetcode.com/tutorials/gtktutorial/. There are may others listed here on the forum under a sticky topic called Tutorials and Resources http://www.gtkforums.com/viewtopic.php?f=3&t=988

_________________
E.


Top
 Profile  
 
 Post subject: Re: I need a example code for gtk_label_get_label( );
PostPosted: Sun Jan 12, 2014 1:53 pm 
Offline
Familiar Face

Joined: Fri Jan 10, 2014 2:29 pm
Posts: 21
Thanks a Lot
Cheers !


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group