GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Apr 25, 2014 1:36 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Newbie: How to lookup "child widget" in widget? (P
PostPosted: Fri Dec 07, 2007 4:34 am 
Offline

Joined: Fri Dec 07, 2007 4:00 am
Posts: 2
Hi,

i am the newbie for GTK.
i use anjuta, glade3.
i have a little problem.

Now i make the VoIP Softphone with GTK+ design with Glade3.

can you see? when the have some people call to you , your phone is ring and show who call to you.
i want to my softphone too.

so, in my handle ring signal function, i will create "ringer" dialog.
in "ringer" have 2 button "accept","reject" and 1 label.

my problem is when i show "ringer" ,
How to i lookup "child widget" in "ringer" ?

i want to

Code:
GtkDialog *ringer; // i will initial in 'main'

static void handlering()
{
GtkWidget *label;
int result;
// When Ringing

label = lookup_widget(GTK_WIDGET(ringer), "t_label");
gtk_label_set_text(label,"Caller Detail");

result = gtk_dialog_run(ringer);
.....
}


in many tutorial is use lookup_widget.
but i try lookup_widget,
when i compile it say "undefined reference to 'lookup_widget' "

i don't know how to i want.
Who can tell me how?

Thank You Very Much.
Watchara Kangkun
Stupid Man


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 07, 2007 4:29 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
lookup_widget is used in a lot of older code which used Glade's code generator rather than libglade. You won't see it so much in newer code.

What you're going to want to do, is pass any references to widgets you need to work with to the callback function. If you need to pass a reference to more than one widget, you can do so by passing in a struct which holds the widgets you need.

Typically, in main or whenever you "create" your interface from the glade_xml_new function, you also get references to any widgets using glade_xml_get_widget and then pass those references as user_data to your various callback functions.

Code:
static void handlering(gpointer user_data)
{
GtkWidget *label;
int result;
  // When Ringing

  label = GTK_WIDGET(user_data);
  gtk_label_set_text(label,"Caller Detail");

  result = gtk_dialog_run(ringer);
  /* ..... */
}

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


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: 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group