On 06-01-2019 17:25, Ron Tarrant wrote:

Thanks for replying, Gerald.

Yes, you're right. I could store them as MainWindow object data and I could also store them in the Button object. But I'm on a voyage of exploration.

On Sun, 06 Jan 2019 00:13:43 GMT, Gerald Nunn wrote:

You cannot change the method signature of event handlers

But, I don't think that's what I would be doing. If these:

button.addOnClicked(&onClicked);

addOnClicked(delegate void(Button b) { buttonAction(message); });
addOnClicked(delegate void(_) { buttonAction(args); });

all work with addOnClicked(), some variation should also be doable with addOnButtonRelease(), etc. if I can find the right syntax.

My 'mission' is to go boldly and all that, to explore and find out what's possible. I'm not necessarily looking for the easy (or accepted) way.

Do you mean something like this:

addOnButtonRelease(delegate bool(Event e, Widget w){ buttonAction(args); 
return false; } );

I don't think the type inference works when both overloads have the same
amount of arguments.

The bool the function returns determines whether Gtk+ continues running
the other registered handlers or not. true if you handled the event
and Gtk should stop or false to let Gtk continue.