You cannot change the method signature of event handlers, I would rewrite your code as follows to pass the arguments to the Window and have the window preserve them as a private variable which can then be referenced from the button handler.
import std.stdio;
import gtk.MainWindow;
import gtk.Main;
import gtk.Widget;
import gtk.Button;
import gdk.Event;
void main(string[] args)
{
string title = "Test Rig OOP";
Main.init(args);
writeln("Argument count ", args.length);
TestRigWindow myTestRig = new TestRigWindow(title, args);
myTestRig.showAll();
Main.run();
} // main()
class TestRigWindow : MainWindow
{
private string[] args;
private void onClicked(Button)
{
foreach (message; args)
{
writeln("The message is: ", message);
}
}
this(string title, string[] args)
{
super(title);
this.args = args;
Button button = new Button("Click this");
button.addOnClicked(&onClicked);
add(button);
addOnDestroy(&quitApp);
} // this()
void quitApp(Widget w)
{
writeln("Bye.");
Main.quit();
} // quitApp()
} // class TestRigWindow