TKD AddProtocolCommand example
DaveG via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed May 14 14:41:03 PDT 2014
Hopefully better formatting of code here:
import tkd.tkdapplication;
class Application : TkdApplication
{
private void exitCommand(CommandArgs args)
{
this.exit();
}
private void saveMeCommand(CommandArgs args)
{
new MessageDialog(this.mainWindow,"Saving...")
.setMessage("Bye")
.show();
}
override protected void initInterface()
{
this.mainWindow.addProtocolCommand(WindowProtocol.saveYourself,
&this.saveMeCommand);
auto frame = new Frame(2, ReliefStyle.groove)
.pack(10);
auto label = new Label(frame, "Hello World!")
.pack(10);
auto exitButton = new Button(frame, "Exit")
.setCommand(&this.exitCommand)
.underlineChar(1)
.pack(10);
}
}
void main(string[] args)
{
auto app = new Application();
app.run();
}
More information about the Digitalmars-d-learn
mailing list