How do I pass a variables as data with gtkd signals ?
Dejan Lekic
dejan.lekic at gmail.com
Fri Jul 25 19:21:07 UTC 2025
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.
More information about the Digitalmars-d-learn
mailing list