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 Nov 21, 2014 4:33 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [SOLVED]Callback function user data
PostPosted: Tue Nov 29, 2011 8:01 pm 
Offline
Familiar Face

Joined: Tue Nov 29, 2011 7:59 pm
Posts: 11
I want to transfer in callback fucntion array of gfloat, how i can make it?


Last edited by F1sher on Wed Nov 30, 2011 7:37 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Callback function user data
PostPosted: Wed Nov 30, 2011 5:56 am 
Offline
GTK+ Guru

Joined: Sun Apr 06, 2008 6:43 pm
Posts: 286
Location: Fortress of solitude
put it a struct and pass it on:
Code:
typedef struct {
GtkWidget *root;
gint data1;
gdouble data2;
} MyData;

// .. fill the struct

MyData *ptr = g_slice_new (MyData); // remember to use g_slice_free to clean-up
ptr->data2 = 23.69797777;
g_signal_connect(object, "some-signal", G_CALLBACK(cb_hello), ptr);

// in cb_hello

void cb_hello (GObject obj, MyData *prv) {
// now use prv->data2
}

_________________
* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.


Top
 Profile  
 
 Post subject: Re: Callback function user data
PostPosted: Wed Nov 30, 2011 7:34 am 
Offline
Familiar Face

Joined: Tue Nov 29, 2011 7:59 pm
Posts: 11
Thank you!


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 2 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