Re: [Vala] Allowable to add user data to callback?



On Sat, Aug 20, 2011 at 03:43:47PM -0700, bsquared wrote:
On Sat, Aug 20, 2011 at 2:56 PM, Luca Bruno <lethalman88 gmail com> wrote:

https://live.gnome.org/Vala/FAQ#How_do_I_pass_user_data_to_a_callback.3F

--
http://www.debian.org - The Universal Operating System


Thanks for the quick response.  I feel fairly thick because I don't
understand how the snippets in the FAQ can apply.  They seem to assume
some knowledge that I don't have.

Then you probably want to take a look at the tutorial about lambda
expression:
https://live.gnome.org/Vala/Tutorial#Anonymous_Methods_.2BAC8_Closures

if these are the signatures:
delegate void SampleCB(Object o);
set_sample_callback(SampleCb? cb=null);

how would I add a user data element such as?
void sample_cb(Object o, void* userdata) {...}
int my_data = 0;
set_sample_callback(the_object, &my_data);

This is meaningless in Vala without showing the body of the callback.

-- 
http://www.debian.org - The Universal Operating System



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]