On 14-08-2019 21:11, Damian S wrote:

I'm both a D noob and a GTK noob so I might be doing something trivially wrong here.

In glade I set up a button that has a click signal callback called onbuttonclicked. I use builder to read in that file.

If I define the function in D like:

extern(C) void onbuttonclicked() {

writeln("you pushed the button!!!");

}

All works great. But if I try to use the Button as a param in that D method (which I assume is supported as the gtk verison of this takes a pointer - https://developer.gnome.org/gtk3/stable/GtkButton.html#gtk-button-clicked)

extern(C) void onbuttonclicked(Button b) {

writeln("you pushed the button!!!");

b.getLabel();

}

I get a :

Program exited with code -11 on the b.getLabel() line.

Any idea what I am doing wrong?

Thanks in advance!

  • Damian

Since we are dealing with Glade and C callbacks the button parameter is
actually a GtkButton* that you would also get when using C.

You can either create a GtkD object from the pointer using:

Button button = new Button(b);

Or use the C functions directly like: gtk_button_get_label()