开发者

How do you pass more than one variable to a gtk signal handler?

I was told the only/best way to do this is to store the variables in a struct and pass the struct, however it's turned into a gpointer and I can't seem to be able to turn it back into a struct to retrieve the data.

If there is any other way I would like to u开发者_开发百科se that too.


Cast your struct back to the proper type in your signal handler.

MyVariables *vars = (MyVariables *)user_data;

PS. Oh, yeah, and don't forget to allocate your struct; if you pass a local variable, it will have disappeared by the time your signal handler is called.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜