On 23-12-2018 21:33, Chris Bare wrote:

I found a way:

auto view = new RadioMenuItem (group, name);
view.addOnActivate(delegate void(MenuItem foo) {this.selectNotepad();});

This is a bit awkward because view is a RadioMenuItem but since addOnActivate is defined in MenuItem, that's what the delegate parameter must be. Why doesn't inheritance make them equivalent?

Most of the time with GtkD you would use a delegate which has access to
it's context.
There is currently no connectData overload for D as there is for
connect.

I also saw an example that does:

view.addOnActivate(delegate void(_) {this.selectNotepad();});

It works, but I don't understand why.

It works because of type inference by the compiler, _ is the parameter
name and the compiler infers it's type from the definition of
addOnActivate. You can also remove the delegate void part.