Jah
Jah

Reputation: 1039

gtk. how can i get widget by id?

gtk define IO callback as bool func(gtkchannel, GIOCondition,GPointer userdata)

the problem is that I want to send 2 arguments as a user_data: widget and a pointer that will keep my errors form the callback. I know that I can send struct but I want to check if there is another way to do it. is there a way to edit the type of the callback? is there a way to get the widget address?

Upvotes: 2

Views: 2105

Answers (2)

ptomato
ptomato

Reputation: 57870

You have to use a struct, or make your own class and pass that. Alternatively, use GTK from Python or Vala. Passing data to callbacks is much easier in those languages.

Upvotes: 2

mikithskegg
mikithskegg

Reputation: 816

I seem that sending a pointer to structure is a valid and the best way. I always do so. And I guess it is impossible to change callback function signature but rewriting and recompilng libgtk )))

Upvotes: 0

Related Questions