How do I pass a variables as data with gtkd signals ?

huangyy huangyy at gmail.com
Sun Jul 27 12:16:59 UTC 2025


On Friday, 25 July 2025 at 19:21:07 UTC, Dejan Lekic wrote:
> On Friday, 25 July 2025 at 16:44:13 UTC, huangyy wrote:
>> I want to write a small program with gtkd. I need to use 
>> Signals.connectData to transfer an int type parameter to the 
>> callback function. I don't know how to write it. I hope 
>> someone can help me. It would be best if you can provide a 
>> sample code. Thank!
>
> It should be as easy as passing a pointer to your int value as 
> data. You just need to cast it to void* as that is what is 
> expected. More details here: 
> https://api.gtkd.org/gobject.Signals.Signals.connectData.html
>
> Btw, from 
> https://docs.gtk.org/gobject/func.signal_connect_data.html :
>> This function is not directly available to language bindings.
>
> I suppose GtkD guys forced generation of this method. Looks 
> like bindings should not have it.

I am a novice in D language and gtkd programming, so I need a 
sample code for reference, thanks!


More information about the Digitalmars-d-learn mailing list