GTK+ Forums

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

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: using a struct as an argument to g_signal_connect
PostPosted: Thu May 08, 2008 6:55 pm 
Offline

Joined: Mon May 05, 2008 4:21 pm
Posts: 3
Is there a way to send a struct (in my case a collection of GtkWidgets) to the g_signal_connect function as user_data? I'm trying to write a callback whose actions depend on multiple widgets, which is why I need to do this.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 08, 2008 7:45 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Why yes, that is the way we typically do it. You can use g_slice_new to allocate space for your struct.

Here is a small example which does just that. Check it out: http://www.gtkforums.com/about906.html

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


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 08, 2008 11:34 pm 
Offline

Joined: Mon May 05, 2008 4:21 pm
Posts: 3
thanks! that works beautifully.


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