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!
Thread overview | |||||
---|---|---|---|---|---|
|
July 25 How do I pass a variables as data with gtkd signals ? | ||||
---|---|---|---|---|
| ||||
July 25 Re: How do I pass a variables as data with gtkd signals ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to huangyy | 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. |
5 days ago Re: How do I pass a variables as data with gtkd signals ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dejan Lekic | 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! |