TKD AddProtocolCommand example
Gary Willoughby via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed May 14 23:20:15 PDT 2014
On Wednesday, 14 May 2014 at 21:41:04 UTC, DaveG wrote:
> 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();
> }
I'm at work at the minute I'll take a look later on.
More information about the Digitalmars-d-learn
mailing list